Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import schema from XSD to OpenAPI/swagger YAML

I have a schema definition in a XSD file which is provided by ISO20022. This schema will need to be used in a swagger/openAPI definition (in yaml format). Since the XSD file has about 1000 lines, manual work is impracticable. This old thread mention some solution, but it is not straightforward.

Does anyone know any tool which provides an easy way to import the schema definitions from a XSD file into a swagger/openAPI yaml file?

like image 807
Daniel Cintra Cugler Avatar asked Oct 29 '25 01:10

Daniel Cintra Cugler


2 Answers

You could try xsd2json from the npm module jgexml. It was written to do precisely this for a large API specified in XSD.

like image 112
MikeRalphson Avatar answered Oct 30 '25 22:10

MikeRalphson


I could not escape from manual work in this task. What I've done was using "xsd2json" to convert the XSD schema to JSON. Then, I used the website www.json2yaml.com to get it as YAML. Afterwards, I created a swagger file myself, then merged the YAML file into it. Thanks for your responses!

like image 21
Daniel Cintra Cugler Avatar answered Oct 30 '25 21:10

Daniel Cintra Cugler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!