我正在寻找一些解决方案,或者可能是一些脚本,可以帮助我通过模式验证替换($ref)或扩展其在 YML 文件中的定义。(具体请看下面的例子)
**示例:使用 $ref 输入 **
/pets/{petId}:
get:
summary: Info for a specific pet
operationId: showPetById
tags:
- pets
parameters:
- name: petId
in: path
required: true
description: The id of the pet to retrieve
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Pet:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: …Run Code Online (Sandbox Code Playgroud)