How to ignore swagger resource property for specific http verb(GET,POST,PUT)

一世执手 提交于 2019-12-23 13:26:32

问题


We are implemented spring fox swagger 2 of version 2.6.1, i wanted to display a specific property of a resource for HTTP GET METHOD and not for POST METHOD, i haven't find any approach using swagger 2. Please help thanks.

For example:

Class Employee{

Integer id;
String name;

}

Request URI: GET /api/employee/{id} i should see the swagger request document as

{
  id:"",
  name:""
}

Request URI: POST /api/employee i should see the swagger request sample as

{
    name:""
}

回答1:


I upgraded to version 2.8.0 and it is possible with @ApiModelProperty(readOnly = true). This causes the property to be #Returned by GET, not used in POST / PUT / PATCH



来源:https://stackoverflow.com/questions/42359204/how-to-ignore-swagger-resource-property-for-specific-http-verbget-post-put

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!