Skip to content

Commit

Permalink
fix openapiv3
Browse files Browse the repository at this point in the history
  • Loading branch information
ma91n committed Sep 2, 2024
1 parent 7cf126c commit 13eb200
Show file tree
Hide file tree
Showing 14 changed files with 991 additions and 500 deletions.
913 changes: 431 additions & 482 deletions documents/forOpenAPISpecification/OpenAPI_Specification_3.0.3.md

Large diffs are not rendered by default.

This file was deleted.

Binary file not shown.
10 changes: 10 additions & 0 deletions documents/forOpenAPISpecification/sample_divided/common/error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
32 changes: 32 additions & 0 deletions documents/forOpenAPISpecification/sample_divided/common/pet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
type: object
required:
- id
- name
- category
- age
- sex
properties:
id:
type: integer
format: int64
name:
type: string
maxLength: 50
category:
type: string
maxLength: 10
sub_category:
type: string
maxLength: 50
age:
type: integer
format: int32
sex:
type: string
maxLength: 6
note:
type: string
maxLength: 200
tag:
type: string
maxLength: 20
264 changes: 264 additions & 0 deletions documents/forOpenAPISpecification/sample_divided/openapi.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
openapi: 3.0.3
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: 'http://petstore.swagger.io/v1'
tags:
- name: pets
description: Everything about your Pets
paths:
/pets:
get:
summary: List all pets
operationId: get-pets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
maximum: 100
format: int32
responses:
'200':
description: A paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
type: array
maxItems: 100
items:
$ref: '#/components/schemas/Pet'
examples:
ResExample1:
value:
- id: 10001
name: ToyPoodle
category: dog
sub_category: ToyPoodle
age: 1
sex: male
note: friendly
tag: dog10001
- id: 10002
name: Chihuahua
category: dog
sub_category: Chihuahua
age: 1
sex: female
note: friendly
tag: dog10002
- id: 10003
name: Shiba
category: dog
sub_category: Shiba
age: 1
sex: male
note: friendly
tag: dog10003
- id: 10004
name: MiniatureDachshund
category: dog
sub_category: MiniatureDachshund
age: 1
sex: female
note: friendly
tag: dog10004
ResExample2:
value: []
'404':
description: not found error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
summary: Register a pet
operationId: post-pets
tags:
- pets
requestBody:
content:
application/json:
schema:
required:
- pet
type: object
properties:
pet:
$ref: '#/components/schemas/Pet'
examples:
ReqExample1:
value:
pet:
id: 10005
name: FrenchBulldog
category: dog
sub_category: FrenchBulldog
age: 1
sex: male
note: friendly
tag: dog10005
required: false
responses:
'201':
description: Null response
'404':
description: not found error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'/pets/{petId}':
get:
summary: Details for a pet
operationId: get-pets-pet-id
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:
required:
- pet
- pet_detail
type: object
properties:
pet:
$ref: '#/components/schemas/Pet'
pet_detail:
$ref: '#/components/schemas/PetDetail'
examples:
ResExample1:
value:
pet:
id: 10001
name: ToyPoodle
category: dog
sub_category: ToyPoodle
age: 1
sex: male
note: friendly
tag: dog10001
pet_detail:
breeder: BreederName
date_of_birth: '2023-10-31'
pedigree:
registration_no: 11111111
date_of_registration: '2023-10-31'
pedigree_image: 9j2wBDAA...8QAPxAAAQQABAMGBAYDAAEDAg
'404':
description: not found error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
PetDetail:
type: object
properties:
breeder:
type: string
date_of_birth:
type: string
format: date
pedigree:
$ref: '#/components/schemas/Pedigree'
Pedigree:
required:
- registration_no
- date_of_registration
- pedigree_image
type: object
properties:
registration_no:
type: integer
format: int64
date_of_registration:
type: string
format: date
pedigree_image:
type: string
Pet:
type: object
required:
- id
- name
- category
- age
- sex
properties:
id:
type: integer
format: int64
name:
type: string
maxLength: 50
category:
type: string
maxLength: 10
sub_category:
type: string
maxLength: 50
age:
type: integer
format: int32
sex:
type: string
maxLength: 6
note:
type: string
maxLength: 200
tag:
type: string
maxLength: 20
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
30 changes: 30 additions & 0 deletions documents/forOpenAPISpecification/sample_divided/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
openapi: "3.0.3"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
tags:
- name: pets
description: Everything about your Pets
paths:
/pets:
get:
$ref: "./pets_get/pets_get.yaml#/operation"
post:
$ref: "./pets_post/pets_post.yaml#/operation"
/pets/{petId}:
get:
$ref: "./pets-pet-id_get/pets-pet-id_get.yaml#/operation"
components:
schemas:
PetDetail:
$ref: "./pets-pet-id_get/pets-pet-id_get.yaml#/components/schemas/PetDetail"
Pedigree:
$ref: "./pets-pet-id_get/pets-pet-id_get.yaml#/components/schemas/Pedigree"
Pet:
$ref: "./common/pet.yaml"
Error:
$ref: "./common/error.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pet:
id: 10001
name: ToyPoodle
category: dog
sub_category: ToyPoodle
age: 1
sex: male
note: friendly
tag: dog10001
pet_detail:
breeder: BreederName
date_of_birth: '2023-10-31'
pedigree:
registration_no: 11111111
date_of_registration: '2023-10-31'
pedigree_image: 9j2wBDAA...8QAPxAAAQQABAMGBAYDAAEDAg
Loading

0 comments on commit 13eb200

Please sign in to comment.