swagger-api / swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
http://swagger.io
Apache License 2.0
7.38k stars 2.18k forks source link

swagger 2.0.0-rc2 removal of ApiOperation requestBody #2562

Closed pjfanning closed 6 years ago

pjfanning commented 6 years ago
Q A
Bug or feature request? Feature Request
Which Swagger-Core version? 2.0.0-rc2
Which Java version? Open JDK 1.8
Which JAX-RS framework & version? N/A

I maintain swagger-akka-http and this is a thin wrapper around swagger-jaxrs. This is a bit of a hack but has worked until now. I have some samples and have been trying to make them work with swagger 2.0.0 RCs. The removal of the requestBody parameter on @ApiOperation in 2.0.0-rc2 leaves me in a bind. There appears to be no way to annotate the requestBody other than via the Java method binding and up until now, we've used the swagger annotations instead of relying on creating an artificial method. Would it be possible to put back the ability to specify requestBody in the swagger annotations?

The sample code I referred to above can be seen here:

https://github.com/pjfanning/swagger-akka-http-sample/blob/swagger-2.0.0/src/main/scala/com/example/akka/add/AddService.scala

frantuma commented 6 years ago

As of 2.0.0-rc3 @RequestBody annotation can be applied to method parameter as detailed in wiki. If I get your point correctly, this is not sufficient for your needs, but you'd like to have it applicable also as field of @Operation, is this right or does the parameter annotation suffice?

pjfanning commented 6 years ago

@frantuma I am asking for it be available on the operation too

frantuma commented 6 years ago

Ok it makes sense, will update soon and will be part of next release

frantuma commented 6 years ago

implemented in #2574