-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(oas): add tests to cover these cases
- Loading branch information
Showing
5 changed files
with
478 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
packages/oas/tests/fixtures/wrong-schema-in-body.oas.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Swagger Petstore | ||
description: | ||
'This is a sample server Petstore server. You can find out more about Swagger | ||
at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For | ||
this sample, you can use the api key `special-key` to test the authorization filters.' | ||
termsOfService: http://swagger.io/terms/ | ||
contact: | ||
email: [email protected] | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
version: 1.0.0 | ||
externalDocs: | ||
description: Find out more about Swagger | ||
url: http://swagger.io | ||
servers: | ||
- url: https://{instance}.swagger.io:{port}/{basePath} | ||
variables: | ||
instance: | ||
default: petstore | ||
port: | ||
enum: | ||
- '8443' | ||
- '443' | ||
default: '8443' | ||
basePath: | ||
default: v2 | ||
paths: | ||
/store/order/{orderId}: | ||
put: | ||
parameters: | ||
- name: orderId | ||
in: path | ||
required: true | ||
schema: | ||
maximum: 10.0 | ||
minimum: 1.0 | ||
type: integer | ||
format: int64 | ||
- name: exclude | ||
in: query | ||
required: true | ||
schema: | ||
type: array | ||
items: | ||
type: string | ||
enum: ['petId', 'quantity', 'shipDate', 'status', 'complete'] | ||
minItems: 1 | ||
maxItems: 5 | ||
uniqueItems: true | ||
- name: api_key | ||
in: header | ||
schema: | ||
type: string | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: 'number' | ||
minimum: 5 | ||
maximum: 3 | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
responses: | ||
200: | ||
description: successful operation | ||
content: | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
400: | ||
description: Invalid ID supplied | ||
content: {} | ||
404: | ||
description: Order not found | ||
content: {} | ||
components: | ||
schemas: | ||
Order: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
petId: | ||
type: integer | ||
format: int64 | ||
quantity: | ||
type: integer | ||
format: int32 | ||
shipDate: | ||
type: string | ||
format: date-time | ||
status: | ||
type: string | ||
description: Order Status | ||
enum: | ||
- placed | ||
- approved | ||
- delivered | ||
complete: | ||
type: boolean | ||
default: false | ||
xml: | ||
name: Order |
111 changes: 111 additions & 0 deletions
111
packages/oas/tests/fixtures/wrong-schema-in-header.oas.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Swagger Petstore | ||
description: | ||
'This is a sample server Petstore server. You can find out more about Swagger | ||
at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For | ||
this sample, you can use the api key `special-key` to test the authorization filters.' | ||
termsOfService: http://swagger.io/terms/ | ||
contact: | ||
email: [email protected] | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
version: 1.0.0 | ||
externalDocs: | ||
description: Find out more about Swagger | ||
url: http://swagger.io | ||
servers: | ||
- url: https://{instance}.swagger.io:{port}/{basePath} | ||
variables: | ||
instance: | ||
default: petstore | ||
port: | ||
enum: | ||
- '8443' | ||
- '443' | ||
default: '8443' | ||
basePath: | ||
default: v2 | ||
paths: | ||
/store/order/{orderId}: | ||
put: | ||
parameters: | ||
- name: orderId | ||
in: path | ||
required: true | ||
schema: | ||
maximum: 10.0 | ||
minimum: 1.0 | ||
type: integer | ||
format: int64 | ||
- name: exclude | ||
in: query | ||
required: true | ||
schema: | ||
type: array | ||
items: | ||
type: string | ||
enum: ['petId', 'quantity', 'shipDate', 'status', 'complete'] | ||
minItems: 1 | ||
maxItems: 5 | ||
uniqueItems: true | ||
- name: x-date | ||
in: header | ||
schema: | ||
type: 'string' | ||
format: 'date' | ||
minLength: 11 | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
responses: | ||
200: | ||
description: successful operation | ||
content: | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
400: | ||
description: Invalid ID supplied | ||
content: {} | ||
404: | ||
description: Order not found | ||
content: {} | ||
components: | ||
schemas: | ||
Order: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
petId: | ||
type: integer | ||
format: int64 | ||
quantity: | ||
type: integer | ||
format: int32 | ||
shipDate: | ||
type: string | ||
format: date-time | ||
status: | ||
type: string | ||
description: Order Status | ||
enum: | ||
- placed | ||
- approved | ||
- delivered | ||
complete: | ||
type: boolean | ||
default: false | ||
xml: | ||
name: Order |
111 changes: 111 additions & 0 deletions
111
packages/oas/tests/fixtures/wrong-schema-in-path.oas.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Swagger Petstore | ||
description: | ||
'This is a sample server Petstore server. You can find out more about Swagger | ||
at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For | ||
this sample, you can use the api key `special-key` to test the authorization filters.' | ||
termsOfService: http://swagger.io/terms/ | ||
contact: | ||
email: [email protected] | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
version: 1.0.0 | ||
externalDocs: | ||
description: Find out more about Swagger | ||
url: http://swagger.io | ||
servers: | ||
- url: https://{instance}.swagger.io:{port}/{basePath} | ||
variables: | ||
instance: | ||
default: petstore | ||
port: | ||
enum: | ||
- '8443' | ||
- '443' | ||
default: '8443' | ||
basePath: | ||
default: v2 | ||
paths: | ||
/store/order/{orderId}: | ||
put: | ||
parameters: | ||
- name: orderId | ||
in: path | ||
required: true | ||
schema: | ||
minimum: 42, | ||
exclusiveMinimum: true | ||
maximum: 43 | ||
exclusiveMaximum: true | ||
type: integer | ||
format: int64 | ||
- name: exclude | ||
in: query | ||
required: true | ||
schema: | ||
type: array | ||
items: | ||
type: string | ||
enum: ['petId', 'quantity', 'shipDate', 'status', 'complete'] | ||
minItems: 1 | ||
maxItems: 5 | ||
uniqueItems: true | ||
- name: api_key | ||
in: header | ||
schema: | ||
type: string | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
responses: | ||
200: | ||
description: successful operation | ||
content: | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Order' | ||
400: | ||
description: Invalid ID supplied | ||
content: {} | ||
404: | ||
description: Order not found | ||
content: {} | ||
components: | ||
schemas: | ||
Order: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
petId: | ||
type: integer | ||
format: int64 | ||
quantity: | ||
type: integer | ||
format: int32 | ||
shipDate: | ||
type: string | ||
format: date-time | ||
status: | ||
type: string | ||
description: Order Status | ||
enum: | ||
- placed | ||
- approved | ||
- delivered | ||
complete: | ||
type: boolean | ||
default: false | ||
xml: | ||
name: Order |
Oops, something went wrong.