cancel
Showing results for 
Search instead for 
Did you mean: 

Extract Request Body from Swagger Definition

New Member

Extract Request Body from Swagger Definition

Hi,

 

We are using https://github.com/APIDevTools/swagger-parser for parsing Swagger definitions of API. We are building our client-side model based on the parsed definition of the swagger.

 

However, we have a  use case where we want to extract the example body from the schema definition of the body parameter for a path operation. Is there any sophisticated way to do this?

 

The swagger parser resolves all the references ( including circular ). We tried our own JSON parsing on the schema definition to generate example body, but that creates issues if there are circular references in the swagger definition. If we configure the swagger parser to ignore circular references, then the entire $ref containing circular reference is ignored and we cannot parse. 

 

Can you guys suggest any sophisticated way or any open source tools which we can use to get the sample example body json for a path operation?

 

New Here?
Join us and watch the welcome video:
Watch the new Interview