-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding openapi-schema-validator and allowing for schema extentions in…
… express-openapi (#71)
- Loading branch information
Showing
25 changed files
with
2,749 additions
and
19 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
204 changes: 204 additions & 0 deletions
204
packages/express-openapi/test/fixtures/basic-usage-api-doc-with-extension.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,204 @@ | ||
{ | ||
"host": "test-host", | ||
"basePath": "/v3", | ||
"definitions": { | ||
"Error": { | ||
"additionalProperties": true | ||
}, | ||
"User": { | ||
"properties": { | ||
"name": { | ||
"oneOf": [ | ||
{ "type": "string" }, | ||
{ "type": "null" } | ||
] | ||
}, | ||
"friends": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/User" | ||
} | ||
} | ||
|
||
}, | ||
"required": [ | ||
"name" | ||
] | ||
} | ||
}, | ||
"info": { | ||
"title": "express-openapi sample project", | ||
"version": "3.0.0" | ||
}, | ||
"paths": { | ||
"/apiDocs": { | ||
"get": { | ||
"description": "Returns the requested apiDoc", | ||
"operationId": "getApiDoc", | ||
"parameters": [ | ||
{ | ||
"description": "The type of apiDoc to return.", | ||
"enum": [ | ||
"apiDoc", | ||
"operationDoc" | ||
], | ||
"in": "query", | ||
"name": "type", | ||
"type": "string" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "The requested apiDoc.", | ||
"schema": { | ||
"type": "object" | ||
} | ||
}, | ||
"default": { | ||
"description": "The requested apiDoc." | ||
} | ||
} | ||
}, | ||
"parameters": [] | ||
}, | ||
"/users": { | ||
"parameters": [], | ||
"delete": { | ||
"description": "Delete users.", | ||
"operationId": "deleteUsers", | ||
"tags": ["users"], | ||
"parameters": [], | ||
"responses": { | ||
"204": { | ||
"description": "Users were successfully deleted." | ||
} | ||
} | ||
}, | ||
"post": { | ||
"description": "Create a new user.", | ||
"operationId": "createUser", | ||
"tags": [ | ||
"users", | ||
"creating" | ||
], | ||
"parameters": [], | ||
"responses": { | ||
"default": { | ||
"description": "Unexpected error", | ||
"schema": { | ||
"$ref": "#/definitions/Error" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/users/{id}": { | ||
"parameters": [ | ||
{ | ||
"description": "Fred's age.", | ||
"in": "path", | ||
"name": "id", | ||
"required": true, | ||
"type": "string" | ||
} | ||
], | ||
"get": { | ||
"description": "Retrieve a user.", | ||
"operationId": "getUser", | ||
"parameters": [ | ||
{ | ||
"description": "The name of this person. It may only be \"fred\".", | ||
"in": "query", | ||
"name": "name", | ||
"pattern": "^fred$", | ||
"type": "string" | ||
}, | ||
{ | ||
"description": "Fred's age.", | ||
"in": "path", | ||
"name": "id", | ||
"required": true, | ||
"type": "integer" | ||
}, | ||
{ | ||
"default": 80, | ||
"description": "Fred's age.", | ||
"in": "query", | ||
"name": "age", | ||
"type": "integer" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Requested user", | ||
"schema": { | ||
"$ref": "#/definitions/User" | ||
} | ||
}, | ||
"default": { | ||
"description": "Unexpected error", | ||
"schema": { | ||
"$ref": "#/definitions/Error" | ||
} | ||
} | ||
}, | ||
"tags": [ | ||
"users", | ||
"fooey" | ||
] | ||
}, | ||
"post": { | ||
"description": "Create a user.", | ||
"operationId": "createUser", | ||
"parameters": [ | ||
{ | ||
"in": "body", | ||
"name": "user", | ||
"schema": { | ||
"$ref": "#/definitions/User" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"default": { | ||
"description": "Unexpected error", | ||
"schema": { | ||
"$ref": "#/definitions/Error" | ||
} | ||
} | ||
}, | ||
"tags": [ | ||
"users" | ||
] | ||
} | ||
} | ||
}, | ||
"swagger": "2.0", | ||
"tags": [ | ||
{ | ||
"name": "creating" | ||
}, | ||
{ | ||
"name": "fooey" | ||
}, | ||
{ | ||
"description": "Everything users", | ||
"name": "users" | ||
} | ||
], | ||
"x-express-openapi-schema-extension": { | ||
"definitions": { | ||
"schema": { | ||
"properties": { | ||
"oneOf": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"$ref": "#/definitions/schema" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.