This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-docs.git
The following commit(s) were added to refs/heads/master by this push:
new d6501ef add examples for swagger annotation (#343)
d6501ef is described below
commit d6501efc9540fe81e73909a3edf157574d12d737
Author: liubao68 <[email protected]>
AuthorDate: Mon Jul 8 15:30:40 2024 +0800
add examples for swagger annotation (#343)
---
.../zh_CN/docs/build-provider/swagger-annotation.md | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git
a/java-chassis-reference/zh_CN/docs/build-provider/swagger-annotation.md
b/java-chassis-reference/zh_CN/docs/build-provider/swagger-annotation.md
index c750fd6..b961c4e 100644
--- a/java-chassis-reference/zh_CN/docs/build-provider/swagger-annotation.md
+++ b/java-chassis-reference/zh_CN/docs/build-provider/swagger-annotation.md
@@ -4,10 +4,12 @@
关于Swagger注解的含义,可以在
[Swagger注解文档](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations)
中找到官方说明。
-## 例子
+## 常用例子
* @OpenAPIDefinition
+`@OpenAPIDefinition`可以用来给契约添加Tag或者前缀信息。
+
```java
@OpenAPIDefinition(servers = {@Server(url = "/SameService1")})
public interface SameService1 {
@@ -18,6 +20,8 @@ public interface SameService1 {
* @Operation
+`@Operation`可以用来定义`operationId`或者给契约增加描述信息。
+
```java
@GetMapping(path = "/specialNameModel")
@Operation(summary = "specialNameModel", operationId = "specialNameModel")
@@ -25,3 +29,16 @@ public SpecialNameModel
specialNameModel(@RequestParam("code") int code, @Reques
return model;
}
```
+
+* @Parameter
+
+`@Parameter`可以用来描述 query 或者 header 参数的集合类型,给参数添加注释等。
+
+```java
+@Path("headerListCSV")
+@GET
+String headerListCSV(@Parameter(name = "headerList", in = ParameterIn.HEADER,
+ style = ParameterStyle.FORM, explode = Explode.FALSE)
+ List<String> headerList);
+```
+