-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xs:choice and xs:sequence ignored in properties #55
Comments
The
A possible direct translation would be:
But what if we change one of the
If we change the JSON Schema accordingly, the following is the result:
But this is not the same as the given XML Schema! Although the object containing only a
The same applies for modelling the So we have to first think of an appropriate representation of these XML Schemas. |
Following my understanding of XML schema, putting minOccurs="0" within a "choice " is an (legal) over-definition since each choice item has an implicit minOccurs="0" allowing it not to be chosen. |
@fnogatz is there an update on this issue? would appreciate a basic implementation with the first suggestion above. |
+1 for a first pass implementation to this (have wrapped xsd2json in my own xs:choice implementation, but it'd be good to get one from source). Great work btw - this utility propelled me about 4 weeks forward on some work I'm doing |
Is this anywhere available? It might be a good inspiration for native xsd2json support. |
<xs:sequence>
<xs:element name="owl" type="xs:string" />
<xs:choice>
<xs:element name="cat" type="xs:string" />
<xs:element name="dog" type="xs:string" minOccurs="0" />
<xs:element name="wolf" type="xs:string" />
</xs:choice>
</xs:sequence> could be translated to: type: object
properties:
owl:
type: string
required: [owl]
oneOf:
- properties:
cat:
type: string
required: [cat]
- properties:
dog:
type: string
- properties:
wolf:
type: string
required: [wolf] |
The following schema element
gives this JSON schema fragment:
We can see that children elements COOSYS/GROUP/PARAM are ignored. Therefore they are not validated although their schema is well defined in the schema.
The text was updated successfully, but these errors were encountered: