小编pra*_*one的帖子

OpenAPI 规范 (YML/YAML):所有 $refs 替换或扩展为其定义(带有模式验证)

我正在寻找一些解决方案,或者可能是一些脚本,可以帮助我通过模式验证替换($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)

python java yaml openapi

8
推荐指数
1
解决办法
4602
查看次数

标签 统计

java ×1

openapi ×1

python ×1

yaml ×1