zoukankan      html  css  js  c++  java
  • Swagger中常用注解

    使用swagger时,

    @ApiOperation表示生成API文档,

    @Apiignore表示忽略生成。

    @ApiIgnore 可以用在类、方法上,方法参数中,用来屏蔽某些接口或参数,使其不在页面上显示。
    1、作用在类上时,整个类都会被忽略

    @ApiIgnore
    @Api(tags = {"Xxx控制类"})
    @RestController
    @RequestMapping("/xxx")
    public class XxxController {
    		......
    }
    

     隐藏某个类还可以用@Api注解自带的hidden属性:

    @Api(value = "xxx", tags = "xxx",hidden = true)

    当hidden为true时,该类隐藏

     2、当作用在方法上时,方法将被忽略

    @ApiIgnore
    @ApiOperation(value = "xxx", httpMethod = "POST", notes = "xxx")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "xxx", value = "xxx", paramType = "query", dataType = "String", required = true)
    })
    @PostMapping("/xxx")
    public Result importCarryEquExcel(String xxx) {
                    ......
    }

    隐藏某个方法还可以用@APIOperation注解自带的hidden属性

    @ApiIgnore
    @ApiOperation(value = "xxx", httpMethod = "POST", notes = "xxx")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "xxx", value = "xxx", paramType = "query", dataType = "String", required = true)
    })
    @PostMapping("/xxx")
    public Result importCarryEquExcel(String xxx) {
                    ......
    }

    隐藏某个方法还可以用@APIOperation注解自带的hidden属性:

    @ApiOperation(value = "xxx", httpMethod = "GET", notes = "xxx",hidden = true)

    当hidden为true时,该方法隐藏

    3、作用在参数上时,单个具体的参数会被忽略

    public String abc(@ApiIgnore String a, String b, String c){
        return "a" + "b" + "c";
      }
  • 相关阅读:
    11gR2新特性:STANDBY_MAX_DATA_DELAY
    ASM file metadata operation等待事件
    Slide:配置GoldenGate同步DDL语句
    C++中Static作用和使用方法
    LPARAM类型转化为CString类型
    Dword、LPSTR、LPWSTR、LPCSTR、LPCWSTR、LPTSTR、LPCTSTR
    C++ inline函数 介绍
    C++ 注册表编程
    C++中L和_T()之区别
    枚举的访问方式
  • 原文地址:https://www.cnblogs.com/javakangkang/p/14118816.html
Copyright © 2011-2022 走看看