Example object with RequestBody support
See original GitHub issue- Question.
I know ‘defaultValue’ property is no more supported for
RequestBody. Is ‘Example’ property works for ‘RequestBody’? I do not see any sample in docs for it. Tried using SpringFox 2.9.2, following code for reference:
@ApiParam(name = "body",value = "Request body in JSON format...",required=true,
examples = @io.swagger.annotations.Example(value= @ExampleProperty( mediaType = MediaType.APPLICATION_JSON_VALUE,
value = "{foo: whatever, bar: whatever2}"))
) @RequestBody String body,
I would like to display one large JSON as example value for request body and clicking on ‘Try it out’ application should show same in edit mode. Please refer to following URL for my expectation behavior []https://petstore.swagger.io/#/store/placeOrder Also note that I am not passing any objects in parameters to method, it is simple ‘String’ type request body as I have mentioned above in my code snippet. Please suggest.
_Originally posted by @vaibhavn in https://github.com/springfox/springfox/issues/853#issuecomment-438263148_
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Spring's RequestBody and ResponseBody Annotations
In this quick tutorial, we provide a concise overview of the Spring @RequestBody and @ResponseBody annotations.
Read more >The @RequestBody Annotation - Spring Framework Guru
The @RequestBody annotation tells Spring to deserialize an incoming request body into an object passed as a parameter to the handler method.
Read more >Spring boot @RequestBody annotation example - B2 Tech
@RequestBody annotation is used to indicating a method parameter should be bind to the body of the HTTP request. Internally, this annotation ...
Read more >Using @RequestBody and @ResponseBody with Spring MVC
The @RequestBody annotation tells Spring MVC to read the request body and assign the value to the annotated method parameter. As the first...
Read more >@PostMapping and @RequestBody Example in Spring Boot ...
In this Spring Boot REST tutorial, you will learn how to use the @PostMapping annotation to make your RESTful Web Service Endpoint able...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am also facing the same problem, In my case our legacy REST API payload is very complicated. If we do not provide sample then our Open APIs are of no use.
any updates?