1
我使用swagger maven插件在構建時生成了swagger文檔。從java註解中生成swagger docus,缺少安全定義
這適用於基本@SwaggerDefinition
註釋。 但是在最終的json和yaml文件中不會生成子部分securityDefinition
。
我在版本3.1.4
任何想法使用swagger-maven-plugin什麼可能會丟失?
@SwaggerDefinition(
info = @Info(
description = "Interact with example",
version = "V1.1.0",
title = "The example API",
termsOfService = "http://example.com",
contact = @Contact(
name = "André Schild",
email = "[email protected]",
url = "http://example.com"
),
license = @License(
name = "example License",
url = "http://example.com/"
)
),
host = "api.example.com",
basePath = "/api/v1",
consumes = {"application/json"},
produces = {"application/json"},
schemes = {SwaggerDefinition.Scheme.HTTPS},
securityDefinition = @SecurityDefinition(
basicAuthDefinions = {
@BasicAuthDefinition(key = "basicAuth")},
apiKeyAuthDefintions = {
@ApiKeyAuthDefinition(key = "exampleAuth", name = "apiKey", in = ApiKeyLocation.HEADER)}),
tags = {
@Tag(name = "API", description = "Api for example"),
@Tag(name = "V1", description = "V1 Api for example")
},
externalDocs = @ExternalDocs(
value = "example",
url = "http://example.com"
)
)
這裏什麼最終招搖文件看起來像:
---
swagger: "2.0"
info:
description: "Interact with example"
version: "V1.1.0"
title: "The example API"
termsOfService: "http://example.com"
contact:
name: "André Schild"
url: "http://example.com"
email: "[email protected]"
license:
name: "example License"
url: "http://example.com/"
host: "api.example.com"
basePath: "/api/v1"
tags:
- name: "categories"
description: "Operations about categories"
paths:
/categories:
get:
.... and more paths/definitions....
嗯..這不適合我的工作。我在與其他定義相同的位置創建了新的接口類,但它不包含在文檔中。 –