Skip to content

Commit

Permalink
tests: re-enable snapshot tests + regen
Browse files Browse the repository at this point in the history
chore: use update and more extensive petstore spec samples
  • Loading branch information
yhnavein committed Jul 3, 2024
1 parent 6704687 commit 9303b3f
Show file tree
Hide file tree
Showing 10 changed files with 1,289 additions and 644 deletions.
3 changes: 2 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"./test/test-setup.ts"
],
"spec": [
"src/**/*.spec.ts"
"src/**/*.spec.ts",
"test/*.spec.ts"
]
}
153 changes: 102 additions & 51 deletions test/petstore-v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,61 @@
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team",
"email": "[email protected]",
"url": "http://swagger.io"
},
"license": {
"name": "MIT"
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"servers": [
{
"url": "http://petstore.swagger.io/v1"
"url": "https://petstore.swagger.io/v2"
}
],
"paths": {
"/pets": {
"get": {
"summary": "List all pets",
"operationId": "listPets",
"tags": [
"pets"
],
"operationId": "findPets",
"parameters": [
{
"name": "tags",
"in": "query",
"description": "tags to filter by",
"required": false,
"style": "form",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "limit",
"in": "query",
"description": "How many items to return at one time (max 100)",
"description": "maximum number of results to return",
"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"
}
}
},
"description": "pet response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pets"
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
Expand All @@ -65,24 +75,29 @@
}
},
"post": {
"summary": "Create a pet",
"operationId": "createPets",
"tags": [
"pets"
],
"description": "Creates a new pet in the store. Duplicates are allowed",
"operationId": "addPet",
"requestBody": {
"description": "Pet to add to the store",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
"$ref": "#/components/schemas/NewPet"
}
}
},
"required": true
}
},
"responses": {
"201": {
"description": "Null response"
"200": {
"description": "pet response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"default": {
"description": "unexpected error",
Expand All @@ -97,27 +112,25 @@
}
}
},
"/pets/{petId}": {
"/pets/{id}": {
"get": {
"summary": "Info for a specific pet",
"operationId": "showPetById",
"tags": [
"pets"
],
"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": "petId",
"name": "id",
"in": "path",
"description": "ID of pet to fetch",
"required": true,
"description": "The id of the pet to retrieve",
"schema": {
"type": "string"
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "Expected response to a valid request",
"description": "pet response",
"content": {
"application/json": {
"schema": {
Expand All @@ -137,22 +150,67 @@
}
}
}
},
"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": {
"allOf": [
{
"$ref": "#/components/schemas/NewPet"
},
{
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
}
}
]
},
"NewPet": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
Expand All @@ -161,13 +219,6 @@
}
}
},
"Pets": {
"type": "array",
"maxItems": 100,
"items": {
"$ref": "#/components/schemas/Pet"
}
},
"Error": {
"type": "object",
"required": [
Expand Down
Loading

0 comments on commit 9303b3f

Please sign in to comment.