RequestBody parameter annotation problem - swagger 2.0.0-RC1

283 views
Skip to first unread message

Chris Olson

unread,
Oct 2, 2017, 7:51:41 PM10/2/17
to Swagger
I am not seeing the requestBody in the resulting openApi.json.

Below is a method in my java class with gradle swagger dependency: io.swagger:swagger-jaxrs2:2.0.0-rc1

No matter what I try I don't get the resulting RequestBody structure as detailed in the documentation. It's documenting the NewPerson param in the parameters array instead. It is interesting that in rc1, the Operation takes a RequestBody, but in rc2 they dropped that. Confusing. 

The resulting openApi.json:
"post": {
"parameters": [
{
"schema": {
"$ref": "#/components/schemas/NewPerson"
}
}],
"responses": {
"200": {
"content":
...
}
}
}


The code:
import io.swagger.oas.annotations.Operation;
import io.swagger.oas.annotations.media.Content;
import io.swagger.oas.annotations.media.Schema;
import io.swagger.oas.annotations.parameters.RequestBody;
import io.swagger.oas.annotations.responses.ApiResponse;

 @POST 
 @Produces({MediaType.APPLICATION_JSON})
 @Consumes(MediaType.APPLICATION_JSON)  
 @Operation()
    public Response post(        
        @RequestBody(description = "New Person", required = true, content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = NewPerson.class)))  NewPerson np
    )
    {}

Ron Ratovsky

unread,
Oct 2, 2017, 9:45:51 PM10/2/17
to swagger-sw...@googlegroups.com

Can you file a ticket on the project with the details below?

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages