wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

@ApiOperation with value only breaks displaying documentation for Api (controller) #32

Closed szpak closed 10 years ago

szpak commented 10 years ago

Description: I would expect to define only required properties in @ApiOperation and allow swagger4spring to get default values for others. Currently @ApiOperation with value only causes an API for a class (controller) to be not expandable in GUI.

How to reproduce: In swagge4springweb-example (tested on master) for person() method in PersonController change @ApiOperation to @ApiOperation(value = "Find specific person").

Additional notes: Maybe related thing - it would be nice to have to define response field only for not trival classes (e.g. wrappers like ResponseEntity). Currently even for simple classes defined as @ApiModel (like Person) response type is not shown in GUI if response is not explicit defined.

seawatts commented 10 years ago

I am having this exact same problem. There are quite a few bugs that have been introduced into this release that make this library not usable anymore.

It looks like when you click the "Expand Operations" link next to the endpoint name it will show them all. The common theme I have seen for all the ones that you cannot open manually is they dont have a "Response Content Type"

wkennedy commented 10 years ago

@szpak Thank you for posting this bug. I've created a fix for this issue. If there is no httpMethod specified in the ApiOperation annotation then it will look for the method in RequestMapping. As for your additional notes, I'll create a new issue for what you are describing. It sounds like you want to default to the method return type for the response in ApiOperation if no response is specified. This will be possible, unless you are using generics, in which case you will only see the collection class.

@Eibach I'm terribly sorry you are having so many issues with the newest release. Please post anything you find and I'll do my best to resolve these issues. To support the latest version of Swagger I needed to rewrite much of the code and I need some help sorting any issues that came out of the refactor.

seawatts commented 10 years ago

Thanks wkennedy! I wasnt trying to be rude about it, I know it was a pretty big update on the swagger core spec. I saw you made a new release 0.3.1-SNAPSHOT. Is that available in maven?

wkennedy commented 10 years ago

Oh, no worries! I know you weren't trying to be rude. I haven't deployed the 0.3.1 to the Maven repo yet. I'll do some more testing and hopefully get that pushed out tonight.

seawatts commented 10 years ago

Great Thanks again!