首页 > 编程知识 正文

swagger实体类注解,swagger常用注解

时间:2023-05-05 21:33:32 阅读:157684 作者:587

@ApiIgnore可用于屏蔽类、方法和方法参数中的特定接口和参数,使其不出现在页面上。

1、作用于类时,全班被忽略

@APIignore@API(tags=(XXX控件类) (restcontroller@requestmapping ) )/XXX ) ) publicclassXXXcontroller )…}某一部分

@API(value='XXX ',tags='xxx ',hidden=true ) )如果hidden为true,则隐藏此类。

2、作用于方法时,方法被忽略

@ API ignore @ API operation (value=' XXX ',httpMethod='POST ',notes='xxx ' ) apimplicitparams @ apimplicitparams paramType='query ',dataType='String ',required=true(} ) postmapping(/XXX ) ) publicresultimportcarryequexxxxxx

@APIoperation(value='XXX ',httpMethod='GET ',notes='xxx ',hidden=true ) )如果hidden为true,则隐藏此方法。

3、作用于参数时,单个具体参数被忽略

public string ABC (apiignorestringa,String b,String c ) return'a'b''c ); }补充:

4、如何忽略实体类中不必要的字段:

(1)用@ApiModelProperty注释填写附属的hidden属性:

@apimodelproperty(value='xxxid ',required=true,hidden=true ) private Long id; (2)使用@JsonIgnore注释:

@apimodelproperty(value='xxxid ',required=true ) @JsonIgnore private Long id; 包名称:

import com.fasterxml .温柔的天空. annotation.JsonIgnore;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。