Skip to content

Commit

Permalink
test: add multi-spec test
Browse files Browse the repository at this point in the history
  • Loading branch information
cdimascio committed Feb 28, 2021
1 parent 8d27580 commit 1f50892
Show file tree
Hide file tree
Showing 3 changed files with 446 additions and 0 deletions.
173 changes: 173 additions & 0 deletions test/multi.spec/api.v1.yaml
@@ -0,0 +1,173 @@
openapi: '3.0.0'
info:
version: 1.0.0
title: Swagger Petstore
description: A sample API
termsOfService: http://swagger.io/terms/
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: /v1
paths:
/pets:
get:
description: |
Returns all pets
operationId: findPets
parameters:
- name: type
in: query
description: maximum number of results to return
required: true
schema:
type: string
enum:
- dog
- cat
- name: tags
in: query
description: tags to filter by
required: false
style: form
schema:
type: array
items:
type: string
- name: limit
in: query
description: maximum number of results to return
required: true
schema:
type: integer
format: int32
minimum: 1
maximum: 20
responses:
'200':
description: pet response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

post:
description: Creates a new pet in the store.
operationId: addPet
security:
- ApiKeyAuth: []
requestBody:
description: Pet to add to the store
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
responses:
'200':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/pets/{id}:
get:
description: Returns a user based on a single ID, if the user does not have access to the pet
operationId: find pet by id
parameters:
- name: id
in: path
description: ID of pet to fetch
required: true
schema:
type: integer
format: int64
responses:
'200':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
description: deletes a single pet based on the ID supplied
operationId: deletePet
parameters:
- name: id
in: path
description: ID of pet to delete
required: true
schema:
type: integer
format: int64
responses:
'204':
description: pet deleted
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

components:
schemas:
Pet:
required:
- id
- name
- type
properties:
id:
readOnly: true
type: number
name:
type: string
tag:
type: string
type:
$ref: '#/components/schemas/PetType'

PetType:
type: string
enum:
- dog
- cat

Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string

securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
155 changes: 155 additions & 0 deletions test/multi.spec/api.v2.yaml
@@ -0,0 +1,155 @@
openapi: '3.0.0'
info:
version: 1.0.0
title: Swagger Petstore
description: A sample API
termsOfService: http://swagger.io/terms/
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: /v2
paths:
/pets:
get:
description: |
Returns all pets
operationId: findPets
parameters:
- name: pet_type
in: query
description: maximum number of results to return
required: true
schema:
type: string
enum:
- doggy
- kitty
responses:
'200':
description: pet response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

post:
description: Creates a new pet in the store.
operationId: addPet
security:
- ApiKeyAuth: []
requestBody:
description: Pet to add to the store
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
responses:
'200':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/pets/{id}:
get:
description: Returns a user based on a single ID, if the user does not have access to the pet
operationId: find pet by id
parameters:
- name: id
in: path
description: ID of pet to fetch
required: true
schema:
type: integer
format: int64
responses:
'200':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
description: deletes a single pet based on the ID supplied
operationId: deletePet
parameters:
- name: id
in: path
description: ID of pet to delete
required: true
schema:
type: integer
format: int64
responses:
'204':
description: pet deleted
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

components:
schemas:
Pet:
required:
- id
- name
- type
properties:
pet_id:
readOnly: true
type: number
pet_name:
type: string
pet_tag:
type: string
-pet_type:
$ref: '#/components/schemas/PetType'

PetType:
type: string
enum:
- doggy
- kitty

Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string

securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key

0 comments on commit 1f50892

Please sign in to comment.