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 
<https://github.com/swagger-api/swagger-core/wiki/Annotations-2.X#requestbody>. 
It's documenting the NewPerson param in the parameters array instead. It is 
interesting that in rc1 
<http://docs.swagger.io/swagger-core/v2.0.0-RC1/apidocs/index.html?io/swagger/oas/annotations/Operation.html>,
 
the Operation takes a RequestBody, but in rc2 
<http://docs.swagger.io/swagger-core/v2.0.0-RC2/apidocs/index.html?io/swagger/oas/annotations/Operation.html>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
    )
    {}

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to