我试图为一个应用程序生成两个不同的模型,它们具有不同的版本,具有相同的端点名称和操作 ID,如下所示。 搜索后,了解到添加 x-version: "v2" 应该在 swagger ui 中给出两个同名的端点,但没有用。
-> 我可以使用具有不同版本的应用程序吗(尽管更改也以小文本显示,与 端点名称、操作 ID 的相似结构?
-> 我想在 swagger ui 中看到这两个名字。
-> 使用 python-flask 生成 下面是类似的例子:
# Example YAML file
openapi: 3.0.0
info:
title: "RP Flask REST API"
description: "An API about people and notes"
version: "1.0.0"
servers:
- url: "/api"
paths:
/people:
get:
operationId: "people.read_all"
x-version: "v1"
tags:
- "People"
summary: "Read the list of people"
responses:
"200":
description: "Successfully read people list"
/people:
get:
operationId: "people.read_all"
x-version: "v2"
tags:
- "People"
summary: "Read the list of people"
responses:
"200":
description: "Successfully read people list"
put:
operationId: "people.read_all"
x-version: "v2"
tags:
- "People"
summary: "write the list of people"
responses:
"200":
description: "Successfully written people list"
'''