Hi,
Since you’re using Spring-MVC, you’re probably using Springfox – and questions about that should be directed at their repository directly. Afaik, Springfox does use swagger-core annotations but swagger-core itself doesn’t support such functionality so you’d have to use different models to describe that. Springfox may have an alternative solution though. From: <[email protected]> on behalf of Raju Madanu <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Tuesday, 2 August 2016 at 20:09 To: Swagger <[email protected]> Subject: How to avoid @ApiModelProperty on DTO or Model Hi, I have a scenario where a DTO is used for POST and PUT operations. I am currently using Spring MVC (RESTful). I would like to reuse DTO in multiple cases. So I want to avoid any annotations in the DTO. I prefer them on the controller instead. I may be wrong but, please advise. Below is the scenario: There are three fields id, a, b in the DTO. For POST operation a and b are required and for PUT operation all three are required. I am currently using attribute "required" in @ApiModelProperty annotation (in DTO). a. How do I enforce conditional required for "id" incase of PUT operation using @ApiModelProperty? b. I would like to have something on the controller itself where I can specify all conditions instead on the DTO itself. That way I can reuse DTO in many scenarios. I tried @ApiImplicitParams with paramType as "body". If I do this, I am seeing multiple body fields instead of one in swagger html documentation. Any suggestions would be greatly helpful. FYI - I have posted this question in stackoverflow http://stackoverflow.com/questions/38721711/how-to-avoid-apimodelproperty-on-dto-or-model -- 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. -- 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.
