Closed
Description
I want to split the following file.
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets/{petId}:
get:
summary: Get Pet
operationId: showPetById
security:
- Everyone: []
tags:
- animals
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"
components:
securitySchemes:
Everyone:
description: everyone
type: "apiKey"
name: "Authorization"
in: "header"
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
I write components
object to external file.
petstore-parent.yaml
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets/{petId}:
get:
summary: Get Pet
operationId: showPetById
security:
- Everyone: []
tags:
- animals
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: "./petstore-child.yaml#/components/schemas/Pet"
petstore-child.yaml
components:
securitySchemes:
Everyone:
description: everyone
type: "apiKey"
name: "Authorization"
in: "header"
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
But I do not know how I refer to external securitySchema
object.
get:
summary: Get Pet
operationId: showPetById
security:
- Everyone: []
How do I refer to external securitySchema
object ?