Last active
August 22, 2018 15:06
-
-
Save ttuan/2a5b456ec526501fd90e6b1bf0a0f310 to your computer and use it in GitHub Desktop.
Swagger UI json file
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
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "API Sample App", | |
"description": "API Sample App", | |
"contact": { | |
"name": "@kymmt90" | |
}, | |
"license": { | |
"name": "MIT" | |
} | |
}, | |
"basePath": "/", | |
"consumes": [ | |
"application/json" | |
], | |
"produces": [ | |
"application/json" | |
], | |
"parameters": { | |
"user_id": { | |
"in": "path", | |
"description": "User ID", | |
"required": true, | |
"type": "integer", | |
"format": "int64" | |
}, | |
"user": { | |
"name": "user", | |
"in": "body", | |
"description": "User attributes", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/UserInput" | |
} | |
} | |
}, | |
"paths": { | |
"/users": { | |
"get": { | |
"description": "Get all users", | |
"operationId": "get_all_user", | |
"responses": { | |
"200": { | |
"description": "All users", | |
"schema": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/UserOutput" | |
} | |
} | |
} | |
} | |
}, | |
"post": { | |
"description": "Creates a user", | |
"operationId": "create_user", | |
"parameters": [ | |
{ | |
"$ref": "#/parameters/user" | |
} | |
], | |
"responses": { | |
"201": { | |
"description": "Created user", | |
"schema": { | |
"$ref": "#/definitions/UserOutput" | |
} | |
}, | |
"400": { | |
"description": "Invalid parameters", | |
"schema": { | |
"$ref": "#/definitions/ErrorOutput" | |
} | |
} | |
} | |
} | |
}, | |
"/users/{id}": { | |
"parameters": [ | |
{ | |
"$ref": "#/parameters/user_id", | |
"name": "id" | |
} | |
], | |
"get": { | |
"description": "Finds the specified user", | |
"operationId": "find_user_by_id", | |
"responses": { | |
"200": { | |
"description": "User specified by its ID", | |
"schema": { | |
"$ref": "#/definitions/UserOutput" | |
} | |
}, | |
"404": { | |
"description": "Resource not found", | |
"schema": { | |
"$ref": "#/definitions/ErrorOutput" | |
} | |
} | |
} | |
}, | |
"patch": { | |
"description": "Updates the user", | |
"operationId": "update_user", | |
"parameters": [ | |
{ | |
"$ref": "#/parameters/user" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Updated user", | |
"schema": { | |
"$ref": "#/definitions/UserOutput" | |
} | |
}, | |
"400": { | |
"description": "Invalid parameters", | |
"schema": { | |
"$ref": "#/definitions/ErrorOutput" | |
} | |
}, | |
"404": { | |
"description": "Resource not found", | |
"schema": { | |
"$ref": "#/definitions/ErrorOutput" | |
} | |
} | |
} | |
}, | |
"delete": { | |
"description": "Deletes the user", | |
"operationId": "delete_user", | |
"responses": { | |
"204": { | |
"description": "The user was deleted" | |
}, | |
"404": { | |
"description": "Resource not found", | |
"schema": { | |
"$ref": "#/definitions/ErrorOutput" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"definitions": { | |
"UserInput": { | |
"required": [ | |
"name", | |
"email" | |
], | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"email": { | |
"type": "string" | |
} | |
} | |
}, | |
"UserOutput": { | |
"required": [ | |
"id", | |
"name", | |
"email" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"email": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment