Closed zrzka closed 5 years ago
Following DSL ...
properties: - foo: type: array items: - schemaA - schemaB
... is transformed to a JSON Schema like this one ...
{ "properties": { "foo": { "type": "array", "items": [ { schemaA }, { schemaB } ] } } }
And it says - array instance is valid if the first item validates against schemaA, second item validates against schemaB, etc.
schemaA
schemaB
items shouldn't enforce order of items.
items
New semantics - an array instance is valid if every single array instance item is valid against ANY schema from items.
{ "properties": { "foo": { "type": "array", "items": { "anyOf": [ { schemaA }, { schemaB } ] } } } }
--- version: 1 title: WiFis properties: - networks: type: array items: - title: WPA2 Personal properties: - ssid: type: string - password: type: password - title: WPA2 Enterprise properties: - ssid: type: string - username: type: string - password: type: password
Should generate a form which allows to add multiple WiFi networks where each network can be WPA2 Personal or WPA2 Enterprise.
WPA2 Personal
WPA2 Enterprise
We should:
+
type
ssid
WPA2 Enterpise
The spec has been updated
Current status
Following DSL ...
... is transformed to a JSON Schema like this one ...
And it says - array instance is valid if the first item validates against
schemaA
, second item validates againstschemaB
, etc.Change
items
shouldn't enforce order of items.New semantics - an array instance is valid if every single array instance item is valid against ANY schema from
items
.Transformation after change
Following DSL ...
... is transformed to a JSON Schema like this one ...
Example
Should generate a form which allows to add multiple WiFi networks where each network can be
WPA2 Personal
orWPA2 Enterprise
.Rendition notes
We should:
+
button where user can add any of these itemstype
with valuesWPA2 Personal
&WPA2 Enterprise
WPA2 Personal
WPA2 Enterprise
ssid
,WPA2 Enterpise
containsssid
as well, we should keep the valueSpecification notes