andrewbober / xsd2jsonschema

A pure JavaScript library for translating complex XML Schemas into JSON Schemas.
https://www.xsd2jsonschema.org
Apache License 2.0
47 stars 25 forks source link

Import referenced xsd's #18

Closed 3ulld0ze closed 5 years ago

3ulld0ze commented 5 years ago

Hi, I am trying to convert some xsd's which have imports from a different location (local file or http) From the documentation Supports large mutli-file XML schemas with circular imports or includes, forward references, and any number of XML namespaces. I am assuming that de-referencing must work. pls correct me if I am wrong.

Can I merge imports in one single schema?

andrewbober commented 5 years ago

Hi ashwaths1 - You can utilize imports in xml schema's being converted. Although, xsd2jsonschema does not attempt to load any files itself. All IO including loading of files is left up to the application using the library. In short, any schemas must be loaded and passed into the library as strings in a hashmap. Then xsd2jsonschema will convert them to JSON Schema. Checkout examples/example.js to see a quick example.

Looking forward I have a command-line application forthcoming that I believe will do what you're looking for without any coding needed.