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.

Reply via email to