为什么在 Swagger UI 中外部文档出现在服务器之前?
Why do external docs show up before servers in Swagger UI?
我有以下 OpenAPI YAML 定义。 externalDocs
部分位于 servers
部分下方,但它在 Swagger 编辑器 (https://editor.swagger.io/) 的预览中显示在服务器之前。这是为什么?
openapi: 3.0.0
info:
title: Service
description: >-
Service description
version: '1.0'
termsOfService: >-
https://pdf/API_Developer_Agreement.pdf
contact:
email: 'contact@contact.com'
name: 'contact Europa'
servers:
- url: http://api.example.com/v1
description: Optional server description, e.g. Main (production) server
- url: http://staging-api.example.com
description: Optional server description, e.g. Internal staging server for testing
externalDocs:
description: "externalDocs"
url: 'https://externalDocs'
paths:
/users:
get:
summary: Returns a list of users.
description: Optional extended description in CommonMark or HTML
responses:
'200':
description: A JSON array of user names
content:
application/json:
schema:
type: array
items:
type: string
Swagger UI 中 info
、externalDocs
和 servers
部分的显示顺序是预定义的,不依赖于它们在 [=19= 中的顺序] 文件。
但是,servers
中的各个服务器、paths
中的各个路径和操作以及架构中的各个属性默认显示的顺序与它们在您的 [=20= 中列出的顺序相同]定义。
我有以下 OpenAPI YAML 定义。 externalDocs
部分位于 servers
部分下方,但它在 Swagger 编辑器 (https://editor.swagger.io/) 的预览中显示在服务器之前。这是为什么?
openapi: 3.0.0
info:
title: Service
description: >-
Service description
version: '1.0'
termsOfService: >-
https://pdf/API_Developer_Agreement.pdf
contact:
email: 'contact@contact.com'
name: 'contact Europa'
servers:
- url: http://api.example.com/v1
description: Optional server description, e.g. Main (production) server
- url: http://staging-api.example.com
description: Optional server description, e.g. Internal staging server for testing
externalDocs:
description: "externalDocs"
url: 'https://externalDocs'
paths:
/users:
get:
summary: Returns a list of users.
description: Optional extended description in CommonMark or HTML
responses:
'200':
description: A JSON array of user names
content:
application/json:
schema:
type: array
items:
type: string
Swagger UI 中 info
、externalDocs
和 servers
部分的显示顺序是预定义的,不依赖于它们在 [=19= 中的顺序] 文件。
但是,servers
中的各个服务器、paths
中的各个路径和操作以及架构中的各个属性默认显示的顺序与它们在您的 [=20= 中列出的顺序相同]定义。