Swagger文档API学习--ApiIgnore注解

  1. Swagger文档API学习–ApiIgnore注解
    1. 源码
      1. value属性
    2. 总结

Swagger文档API学习–ApiIgnore注解

这个注解主要是用来在Swagger生成文档的时候,自动忽略掉、隐藏掉打上该注解的内容。

源码

package springfox.documentation.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER})
public @interface ApiIgnore {
  /**
   * A brief description of why this parameter/operation is ignored
   * @return  the description of why it is ignored
   */
  String value() default "";
}

value属性

简明的说明为什么要忽略掉这个参数。

总结

这个注解和其他注解中的hidden属性有很多类似的地方。在实际的使用中,我们可以根据自己的习惯,进行选择性的使用。


转载请注明来源,欢迎指出任何有错误或不够清晰的表达。可以邮件至 gouqiangshen@126.com

文章标题:Swagger文档API学习--ApiIgnore注解

文章字数:176

本文作者:BiggerShen

发布时间:2019-11-03, 17:45:05

最后更新:2024-01-16, 03:51:15

原始链接:https://shengouqiang.cn/Swagger/SwaggerDocumentLearnDay08/

版权声明: 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏