File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 128128 "description" : " Property values must be a multiple of this number. Only relevant for numeric properties." ,
129129 "type" : " number"
130130 },
131+ "enum" : {
132+ "description" : " Property values must be one of these options. Only relevant for string properties." ,
133+ "type" : " array" ,
134+ "items" : {
135+ "type" : " string"
136+ }
137+ },
131138 "readOnly" : {
132139 "description" : " Whether or not this property is read-only." ,
133140 "type" : " boolean"
Original file line number Diff line number Diff line change @@ -1551,6 +1551,14 @@ class VirtualThingsAdapter extends Adapter {
15511551 }
15521552 }
15531553
1554+ if (
1555+ property . type !== 'string' ||
1556+ ! Array . isArray ( property . enum ) ||
1557+ ! property . enum . length
1558+ ) {
1559+ delete property . enum ;
1560+ }
1561+
15541562 switch ( property . type ) {
15551563 case 'integer' :
15561564 case 'number' :
@@ -1619,6 +1627,10 @@ class VirtualThingsAdapter extends Adapter {
16191627 prop . metadata . multipleOf = property . multipleOf ;
16201628 }
16211629
1630+ if ( property . hasOwnProperty ( 'enum' ) ) {
1631+ prop . metadata . enum = property . enum ;
1632+ }
1633+
16221634 if ( property . hasOwnProperty ( 'readOnly' ) ) {
16231635 prop . metadata . readOnly = property . readOnly ;
16241636 }
You can’t perform that action at this time.
0 commit comments