Take the following #definition from the pet store example. Given a #definition section a JSON structure can be generated
e.g.
Is there something that can do the reverse given a largeish complex JSON file?
Given the below JSON Structure can I get the #defintion section of a swagger file generated to save some typing
{ "variable": "sample", "object1": { "obj-field1": "field 1 of object", "obj-field2": "field 2 of object", "anArray": [ "Value 1", { "anArrayObj1": "obj1fieldinarray", "anArrayObj2": "obj2fieldinarray" } ] } }
You can write a Swagger spec for your API manually, or have it generated automatically from annotations in your source code.
You can drag and drop a path from the Swagger file on to the left boundary of the Process Editor to create a REST service or drag it to the center and select Create Service from the resulting menu.
You can use this JSON-to-OpenAPI schema converter:
https://roger13.github.io/SwagDefGen/
(GitHub project)
I haven't used it personally though, so I'm not sure how good it is.
Since OpenAPI uses a subset of JSON Schema, you could also use one of the JSON Schema generators, however you may need to manually tweak the generated definition to make it OpenAPI-compatible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With