Question about Swagger 2.X Annotations
Hi
I want to use Object(like sample below :Contractor) to get input values from the frontend.
May I use the @RequestBody annotation to define which parameters will pass(not all parameters in the Object)
from the frontend?
@POST @Consumes(MediaType.APPLICATION_JSON) public Response insert(@RequestBody(description = "Created contractor object", required = true, content = @Content( schema = @Schema(implementation = Contractor.class)))Contractor contractor) { ... }
Thanks
This is achievable in latest 2.0.8-SNAPSHOT version and upcoming release by providing an unnamed example to the content, as in test https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SingleExampleResource.java
Before 2.0.8-SNAPSHOT unnamed examples were not supported, you could still add named examples as in https://github.com/swagger-api/swagger-core/blob/898bccdd72c2982f51e2cdab9baac53b7f2c7ac1/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/annotations/examples/ExamplesTest.java#L181, but they not yet supported by UI (support will come soon)