【发布时间】:2022-07-15 17:09:50
【问题描述】:
yaml 和 openapi-generator-maven-plugin 正确地从它生成 Spring Boot 控制器接口。一切正常。但是现在我们想用我们自己的接口覆盖生成的接口之一。我们如何从这一代中排除某个端点?
例子:
paths:
/currencies:
get:
tags:
- DomainData
summary: Lists all valid currencies available.
operationId: "getCurrencies"
parameters:
- $ref: '#/components/parameters/AcceptLanguage'
responses:
"200":
description: "OK"
content:
application/json:
schema:
type: string
additionalProperties:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'5XX':
$ref: '#/components/responses/Unexpected'
/languages:
get:
tags:
- DomainData
summary: Lists all valid languages available.
operationId: "getLanguages"
parameters:
- $ref: '#/components/parameters/AcceptLanguage'
responses:
"200":
description: "OK"
content:
application/json:
schema:
type: string
additionalProperties:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'5XX':
$ref: '#/components/responses/Unexpected'
这是 openapi.yaml 的一部分,我们不想为 /languages 而生成其他所有内容。
【问题讨论】:
-
你不能从 open-api 规范中删除它吗?
-
@ShivajiPote 不,我们从中产生了招摇并希望将其保留在那里。
-
但是如果没有 API 实现,这种招摇会有用吗?
-
是的,它非常有用。问题是网关从另一台服务器获取该端点,但应该大摇大摆地看到它。导致它寻找 API 用户,因为它是一个 api。
标签: spring-boot openapi-generator openapi-generator-maven-plugin