Skip to content
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

sequence element from my XSD schema was generated improperly. #78

Open
tuhai63 opened this issue Nov 29, 2016 · 3 comments
Open

sequence element from my XSD schema was generated improperly. #78

tuhai63 opened this issue Nov 29, 2016 · 3 comments

Comments

@tuhai63
Copy link

tuhai63 commented Nov 29, 2016

Hi!

I tried to generate a JSON schema from a sample XSD. All elements were generated successfully to json schema except one element from my XSD schema was generated improperly.

And here is the element copied from input XSD:

<xs:element name="CONTENT_STATUS_HISTORY">
	<xs:annotation>
		<xs:documentation>Use this element for listing the document history</xs:documentation>
	</xs:annotation>
	<xs:complexType>
		<xs:sequence maxOccurs="unbounded">
			<xs:element name="CONTENT_STATUS" type="TYPE_CONTENT_STATUS_STRUCT"/>
			<xs:element name="SUBMISSION_NUMBER" type="submissionnumberType">
			<xs:annotation>
				<xs:documentation>Submission number for the given Status type</xs:documentation>
			</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:element>

+++++++ See the generated jsonschema below ++++++
I do not know why
jsonschema_issues.txt
name: 'contentstatusAndSUBMISSIONNUMBER',

===================================================================
													
	localName: 'GHSTS.DOCUMENTS.DOCUMENT.DOCUMENTGENERIC.CONTENTSTATUSHISTORY',
        typeName: null,
        propertyInfos: [{
            name: 'contentstatusAndSUBMISSIONNUMBER',
            required: true,
            minOccurs: 2,
            collection: true,
            elementTypeInfos: [{
                elementName: 'CONTENT_STATUS',
                typeInfo: '.TYPECONTENTSTATUSSTRUCT'
              }, {
                elementName: 'SUBMISSION_NUMBER'
              }],
            type: 'elements'
          }]
      }
=================================================================================================


"GHSTS.DOCUMENTS.DOCUMENT.DOCUMENTGENERIC.CONTENTSTATUSHISTORY":{
            "type":"object",
            "title":"GHSTS.DOCUMENTS.DOCUMENT.DOCUMENTGENERIC.CONTENTSTATUSHISTORY",
            "required":[
                "contentstatusAndSUBMISSIONNUMBER"
            ],
            "properties":{
                "contentstatusAndSUBMISSIONNUMBER":{
                    "title":"contentstatusAndSUBMISSIONNUMBER",
                    "allOf":[
                        {
                            "type":"array",
                            "items":{
                                "anyOf":[
                                    {
                                        "anyOf":[
                                            {
                                                "$ref":"#/definitions/TYPECONTENTSTATUSSTRUCT"
                                            }
                                        ],
                                        "elementName":{
                                            "localPart":"CONTENT_STATUS",
                                            "namespaceURI":"http://www.oecd.org/GHSTS"
                                        }
                                    },
                                    {
                                        "anyOf":[
                                            {
                                                "$ref":"http://www.jsonix.org/jsonschemas/w3c/2001/XMLSchema.jsonschema#/definitions/string"
                                            }
                                        ],
                                        "elementName":{
                                            "localPart":"SUBMISSION_NUMBER",
                                            "namespaceURI":"http://www.oecd.org/GHSTS"
                                        }
                                    }
                                ]
                            },
                            "minItems":2
                        }
                    ],
                    "propertyType":"elements"
                }
            },
            "typeType":"classInfo",
            "propertiesOrder":[
                "contentstatusAndSUBMISSIONNUMBER"
            ]
        },
@highsource
Copy link
Owner

Why do you say it is generated improperly?

@tuhai63
Copy link
Author

tuhai63 commented Dec 1, 2016

Why does it generate a name like this : contentstatusAndSUBMISSIONNUMBER and propertyorder like this contentstatusAndSUBMISSIONNUMBER
propertyInfos: [{
name: 'contentstatusAndSUBMISSIONNUMBER',
required: true,
minOccurs: 2,
collection: true,
elementTypeInfos: [{
elementName: 'CONTENT_STATUS',
typeInfo: '.TYPECONTENTSTATUSSTRUCT'
}, {
elementName: 'SUBMISSION_NUMBER'
}],
type: 'elements'
}]

@highsource
Copy link
Owner

Because you have an unbounded sequence with two elements. This results in a heterogeneous collection which may contain items of both elements. This is the only way to adequately represent your XML Schema.

What would you want to be generated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants