按规范:
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md
规范使用的带有附加元数据的标签列表。标签的顺序可以被解析工具用来反射(reflect)它们的顺序。并非操作对象使用的所有标记都必须声明。未声明的标签可以随机组织或基于工具的逻辑。列表中的每个标签名称必须是唯一的。
这些标签在解析器中是如何使用的,你能提供一些例子吗?
还有为什么需要是独一无二的?
最佳答案
几个例子:
pet
, store
和 user
.For example, an endpoint with the "store"
tags
will be generated in theStoreApi
class file.
And also why need to be unique?
标签名称必须是唯一的,因为您不能有两个名称相同的标签。
# Correct
openapi: 3.0.2
tags:
- name: pet # <--- unique tag name
description: Operations to manage the pets
- name: store # <--- unique tag name
descriptions: Access to Petstore orders
# Wrong
openapi: 3.0.2
tags:
- name: pet
- name: pet
关于rest - OpenAPI 中标签的确切用途以及它们为何独一无二,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53517210/