This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves issues where we're filtering out non-endpoint documents (#279)
* Moving non-HTTP code filtering down into create-docs. * Updating package-lock * Running Prettier on create-docs. * Cleaning up how we're rendering common parameters. * Removing some commented out code. * Adding a unit test.
- Loading branch information
Showing
4 changed files
with
320 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"servers": [ | ||
{ | ||
"url": "http://httpbin.org" | ||
} | ||
], | ||
"info": { | ||
"version": "1.0.0", | ||
"title": "An example of how we render $ref usage on resource parameters" | ||
}, | ||
"paths": { | ||
"/anything/{id}": { | ||
"parameters": [ | ||
{ | ||
"in": "path", | ||
"name": "id", | ||
"schema": { | ||
"type": "number" | ||
} | ||
} | ||
], | ||
"get": { | ||
"summary": "Get anything", | ||
"description": "", | ||
"responses": {} | ||
}, | ||
"post": { | ||
"summary": "Post anything", | ||
"description": "", | ||
"parameters": [ | ||
{ | ||
"$ref": "#/components/parameters/limitParam" | ||
} | ||
], | ||
"responses": {} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"parameters": { | ||
"limitParam": { | ||
"in": "query", | ||
"name": "limit", | ||
"required": false, | ||
"schema": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 50, | ||
"default": 20 | ||
}, | ||
"description": "The numbers of items to return." | ||
} | ||
}, | ||
"schemas": { | ||
"string_enum": { | ||
"name": "string", | ||
"enum": [ | ||
"available", | ||
"pending", | ||
"sold" | ||
], | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |
229 changes: 229 additions & 0 deletions
229
packages/api-explorer/__tests__/fixtures/parameters/common.json
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,229 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"servers": [ | ||
{ | ||
"url": "http://petstore.swagger.io/v2" | ||
} | ||
], | ||
"info": { | ||
"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.", | ||
"version": "1.0.0", | ||
"title": "Swagger Petstore", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"email": "apiteam@swagger.io" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
} | ||
}, | ||
"externalDocs": { | ||
"description": "Find out more about Swagger", | ||
"url": "http://swagger.io" | ||
}, | ||
"tags": [ | ||
{ | ||
"name": "pet", | ||
"description": "Everything about your Pets", | ||
"externalDocs": { | ||
"description": "Find out more", | ||
"url": "http://swagger.io" | ||
} | ||
} | ||
], | ||
"paths": { | ||
"/pet/{petId}": { | ||
"parameters": [ | ||
{ | ||
"name": "petId", | ||
"in": "path", | ||
"description": "ID of the pet", | ||
"required": true, | ||
"schema": { | ||
"type": "integer", | ||
"format": "int64" | ||
} | ||
} | ||
], | ||
"get": { | ||
"tags": ["pet"], | ||
"summary": "Find pet by ID", | ||
"description": "Returns a single pet", | ||
"operationId": "getPetById", | ||
"responses": { | ||
"200": { | ||
"description": "successful operation", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/Pet" | ||
} | ||
} | ||
} | ||
}, | ||
"400": { | ||
"description": "Invalid ID supplied" | ||
}, | ||
"404": { | ||
"description": "Pet not found" | ||
} | ||
}, | ||
"security": [ | ||
{ | ||
"api_key": [] | ||
} | ||
] | ||
}, | ||
"post": { | ||
"tags": ["pet"], | ||
"summary": "Updates a pet in the store with form data", | ||
"description": "", | ||
"operationId": "updatePetWithForm", | ||
"responses": { | ||
"405": { | ||
"description": "Invalid input" | ||
} | ||
}, | ||
"security": [ | ||
{ | ||
"petstore_auth": ["write:pets", "read:pets"] | ||
} | ||
], | ||
"requestBody": { | ||
"content": { | ||
"application/x-www-form-urlencoded": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"description": "Updated name of the pet", | ||
"type": "string" | ||
}, | ||
"status": { | ||
"description": "Updated status of the pet", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"tags": ["pet"], | ||
"summary": "Deletes a pet", | ||
"description": "", | ||
"operationId": "deletePet", | ||
"parameters": [ | ||
{ | ||
"name": "api_key", | ||
"in": "header", | ||
"required": false, | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"400": { | ||
"description": "Invalid ID supplied" | ||
}, | ||
"404": { | ||
"description": "Pet not found" | ||
} | ||
}, | ||
"security": [ | ||
{ | ||
"petstore_auth": ["write:pets", "read:pets"] | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Category": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"Tag": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"Pet": { | ||
"type": "object", | ||
"required": ["name", "photoUrls"], | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"format": "int64", | ||
"readOnly": true | ||
}, | ||
"category": { | ||
"$ref": "#/components/schemas/Category" | ||
}, | ||
"name": { | ||
"type": "string", | ||
"example": "doggie" | ||
}, | ||
"photoUrls": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"tags": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/Tag" | ||
} | ||
}, | ||
"status": { | ||
"type": "string", | ||
"description": "pet status in the store", | ||
"enum": ["available", "pending", "sold"] | ||
} | ||
} | ||
} | ||
}, | ||
"securitySchemes": { | ||
"petstore_auth": { | ||
"type": "oauth2", | ||
"flows": { | ||
"implicit": { | ||
"authorizationUrl": "http://petstore.swagger.io/oauth/dialog", | ||
"scopes": { | ||
"write:pets": "modify pets in your account", | ||
"read:pets": "read your pets" | ||
} | ||
} | ||
} | ||
}, | ||
"api_key": { | ||
"type": "apiKey", | ||
"name": "api_key", | ||
"in": "header" | ||
} | ||
} | ||
}, | ||
"x-explorer-enabled": true, | ||
"x-samples-enabled": true, | ||
"x-samples-languages": ["curl", "node", "ruby", "javascript", "python"] | ||
} |
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
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