openapi: 3.0.0
info:title: split test
version: 1.0.0
paths:/pets:get:summary: List all pets
operationId: listPets
tags:- pets
parameters:-name: limit
in: query
description: How many items to return at one time (max 100)
required:falseschema:type: integer
format: int32
responses:'200':description: A paged array of pets
content:application/json:schema:type:"array"items:type: object
required:- id
- name
properties:id:type: integer
format: int64
name:type: string
tag:type: string
/pets/{petId}:get:summary: Info for a specific pet
operationId: showPetById
tags:- pets
parameters:-name: petId
in: path
required:truedescription: The id of the pet to retrieve
schema:type: string
responses:'200':description: Expected response to a valid request
content:application/json:schema:type: object
required:- id
- name
properties:id:type: integer
format: int64
name:type: string
tag:type: string
type: object
required:- id
- name
properties:id:type: integer
format: int64
name:type: string
tag:type: string
あとはこれを ref で参照します
vim openapi.yaml
openapi: 3.0.0
info:title: split test
version: 1.0.0
paths:/pets:get:summary: List all pets
operationId: listPets
tags:- pets
parameters:-name: limit
in: query
description: How many items to return at one time (max 100)
required:falseschema:type: integer
format: int32
responses:'200':description: A paged array of pets
content:application/json:schema:type:"array"items:$ref:"./schemas/pet.yaml"
/pets/{petId}:get:summary: Info for a specific pet
operationId: showPetById
tags:- pets
parameters:-name: petId
in: path
required:truedescription: The id of the pet to retrieve
schema:type: string
responses:'200':description: Expected response to a valid request
content:application/json:schema:$ref:"./schemas/pet.yaml"
name: petId
in: path
required:truedescription: The id of the pet to retrieve
schema:type: string
vim parameters/limit.yaml
name: limit
in: query
description: How many items to return at one time (max 100)
required:falseschema:type: integer
format: int32
あとはそれぞれのファイルをメインのファイルから参照するように変更します
vim openapi.yaml
openapi: 3.0.0
info:title: split test
version: 1.0.0
paths:/pets:get:summary: List all pets
operationId: listPets
tags:- pets
parameters:-$ref:"./parameters/limit.yaml"responses:'200':description: A paged array of pets
content:application/json:schema:type:"array"items:$ref:"./schemas/pet.yaml"
/pets/{petId}:get:summary: Info for a specific pet
operationId: showPetById
tags:- pets
parameters:-$ref:"./parameters/petId.yaml"responses:'200':description: Expected response to a valid request
content:application/json:schema:$ref:"./schemas/pet.yaml"components:parameters:$ref:"./parameters/_index.yaml"
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. というエラーが発生して ElasticSearch が起動しないので事前に変更します
sudo sysctl -w vm.max_map_count=262144
ElasticSearch 起動
シングルノードで起動します
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name es docker.elastic.co/elasticsearch/elasticsearch:8.1.3