Swagger注解-@Api

本文深入解析Swagger注解的使用,包括@ApiOperation、@ApiImplicitParams等,指导如何通过这些注解在SpringBoot项目中生成清晰的API文档,适用于REST接口的开发与维护。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


Swagger注解-@Api
Swagger注解-@ApiOperation
Swagger注解-@ApiImplicitParams 和 @ApiImplicitParam
Swagger注解-@ApiModel 和 @ApiModelProperty
Swagger注解-@ApiResponses 和 @ApiResponse
Swagger注解-@ResponseHeader
Swagger注解-@ApiParam
Swagger注解-@Authorization 和 @AuthorizationScope
Swagger注解-@SwaggerDefinition
Swagger注解-@ExternalDocs
Springboot 集成 Swagger GitHub 地址


使用场景

在 Rest 接口类上边使用。

概述

标记类为 Swagger 资源类,运行时有效。

属性

属性名称数据类型默认值说明
valueString“”隐式设置操作的标记,遗留支持(读取 description)
tagsString[]“”对接口进行分组
producesString“”采用逗号分隔的 content types,例如:application/json,application/xml 生成JSON和XML的输出
consumesString“”采用逗号分隔的 content types,例如: application/json,application/xml 会接收JSON和XML的输入
protocolsString“”采用逗号分隔的可用协议,例如:http,https,ws,wss
authorizationsAuthorization[]“”授权列表
hiddenbooleanfalse隐藏此资源下的操作, 和 @ApiOperation 注解中的 hidden 组合使用可以隐藏改接口

Swagger注解-@Api
Swagger注解-@ApiOperation
Swagger注解-@ApiImplicitParams 和 @ApiImplicitParam
Swagger注解-@ApiModel 和 @ApiModelProperty
Swagger注解-@ApiResponses 和 @ApiResponse
Swagger注解-@ResponseHeader
Swagger注解-@ApiParam
Swagger注解-@Authorization 和 @AuthorizationScope
Swagger注解-@SwaggerDefinition
Swagger注解-@ExternalDocs
Springboot 集成 Swagger GitHub 地址


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值