Forum Discussion

danik56's avatar
danik56
New Contributor
2 months ago

How to define Schema for nested structure

We signed up for Swaggerhub trial and trying to define a sample OpenApi 3.0 POST request.

We have the desired request body in Json format and would like to know how to generate a matching schema definition for it as part of the new API sample.

Is there a tool that can automatically generate the schema based on a given Json structure ? 

(sample request body is attached) 

  • danik56's avatar
    danik56
    New Contributor

    Made progress and was able to define a valid API located here:

    https://app.swaggerhub.com/apis/KALDA0912/sample-api_to_test_cobol_service_cbl_rdf_1/1.0.2

    The request body however, is generated with symbol "[" up front which is invalid. request body in JSON format should start with symbol "{".

    Any idea why wrong symbol is used?