Forum Discussion
HKosova
5 years agoSmartBear Alumni (Retired)
Hi rajrahul9939,
Just to clarify - do you want to generate an example of JSON payload based on a schema definition? Or do you need a mock server that would return sample responses? Or something else?
- rajrahul99395 years agoOccasional Contributor
Hi HKosova
Thank you for your response.
I wanted to generate an example of JSON payload based on a method return type, same as swagger generate the response example.
Thank you
- HKosova5 years agoSmartBear Alumni (Retired)
You can use the Swagger Inflector Java library, specifically its ExampleBuilder class, to generate JSON examples. Here's sample code:
- rajrahul99395 years agoOccasional Contributor
Hey HKosova
swagger-inflector, only works when the schema is defined, Here is more details about my query.
I have an API "/hello" defined below.
and Person class like below.
I wanted to generate a response example like below.
Thank you.
Related Content
- 2 years ago
- 6 years ago
Recent Discussions
- 24 hours ago
- 2 days ago
- 19 days ago