Closed diselop closed 3 years ago
Ok, thanks for comment.
Yes, I really didn't take into account this moment, but what if determined by the <?xml version="1.0" encoding="UTF-8"?>
version?
The version of XML Schema can be determine by the minVersion and maxVersion attributes of the \<schema> tag as described here: https://www.w3.org/2007/XMLSchema-versioning/
The following example indicates schema version 1.0:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns="http://www.xsd2jsonschema.org/example"
targetNamespace="http://www.xsd2jsonschema.org/example"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0.0"
vc:minVersion="1.0"
vc:maxVersion="1.1">
The following example indicates schema version 1.1:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns="http://www.xsd2jsonschema.org/example"
targetNamespace="http://www.xsd2jsonschema.org/example"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0.0"
vc:minVersion="1.1">
Thank you for the PR. Please consider reworking the solution using the suggestion above that leverages https://www.w3.org/2007/XMLSchema-versioning/
Thanks for the pull request. I look forward to incorporating this into the library. But we have to be careful because XML Schema 1.0 and XML Schema 1.1 use different specifications for dateTime and only one of them is consistent with the date-time format used by JSON Schema.
XML Schema 1.0 = ISO 8601 XML Schema 1.1 = RFC 3339 JSON Schema = RFC 3339
The current implementation for dateTime formatting attempts to be ISO 8601 compliant and your solution will replace it with an RFC-3339 compliant solution. What we really need is an option to choose what version of XML Schema is being converted and then follow that spec using code such as what you've provided. Xsd2JsonSchema currently supports XML Schema 1.0 and 1.1 is a work in progress. I could use your help adding support for XML Schema 1.1.