Ask a Question

Getting Example Value of request body

sagarkancherla
New Member

Getting Example Value of request body

Hi, 

we have a spring boot microservice with swagger v3. I need to build a sample request payload json for each path in api docs (exactly how the swagger ui builds a example value payload for each endpoint) . Is there any api provided by swagger to get the example payload directly ?

 

Regards,

Sagar

1 REPLY 1
ponelat
Staff

Hi @sagarkancherla ,

 

I don't think there is any API or library that creates examples. It was a requested feature and something we'd like to have.

 

Here is an issue from 2019 requesting it: https://github.com/swagger-api/swagger-ui/issues/5343

And there may be more.

 

I haven't used it, but https://www.npmjs.com/package/openapi-sampler looks promising for generating JSON (maybe XML?) samples.

 

If you do get it to work for your use-case, post back and let us know!

 

cancel
Showing results for 
Search instead for 
Did you mean: