Skip to content

Generate oneOf for xsd:choice #49

Open
@pdesmarets

Description

@pdesmarets

I'm trying to convert an XSD with lots of tags xsd:choice into a JSON Schema, using your compiler (through Clemens' http://www.xml-buddy.com/ValidatorBuddy.htm)

The good thing is that I got a JSON schema out, which is great already! However, I was expecting to get oneOf keywords. Example:

<xsd:complexType name="PostalCodeMunicipalityComplexType">
    <xsd:choice>
        <xsd:element ref="msg:StructuredPostalCodeMunicipality"/>
        <xsd:element name="UnstructuredPostalCodeMunicipality"
            type="xsd:string">
        </xsd:element>
    </xsd:choice>
</xsd:complexType>

gets returned as:

            "type":"object",
            "title":"PostalCodeMunicipalityComplexType",
            "properties":{
                "structuredPostalCodeMunicipality":{
                    "title":"structuredPostalCodeMunicipality",
                    "allOf":[
                        {
                            "$ref":"#/definitions/StructuredPostalCodeMunicipalityComplexType"
                        }
                    ],
                    "propertyType":"element",
                    "elementName":{
                        "localPart":"StructuredPostalCodeMunicipality",
                        "namespaceURI":"http://schema...."
                    }
                },
                "unstructuredPostalCodeMunicipality":{
                    "title":"unstructuredPostalCodeMunicipality",
                    "allOf":[
                        {
                            "$ref":"http://www.jsonix.org/jsonschemas/w3c/2001/XMLSchema.jsonschema#/definitions/string"
                        }
                    ],
                    "propertyType":"element",
                    "elementName":{
                        "localPart":"UnstructuredPostalCodeMunicipality",
                        "namespaceURI":"http://schema..."
                    }
                }
            },
            "typeType":"classInfo",
            "typeName":{
                "localPart":"PostalCodeMunicipalityComplexType",
                "namespaceURI":"http://schema..."
            },
            "propertiesOrder":[
                "structuredPostalCodeMunicipality",
                "unstructuredPostalCodeMunicipality"
            ]
        }

What am I doing wrong, or misunderstanding?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions