Created
July 9, 2018 02:21
-
-
Save brunowdev/4aa95dac47f1268f97702d27a70d5f51 to your computer and use it in GitHub Desktop.
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
{ | |
"openapi": "3.0.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "Simple API", | |
"description": "A simple API to illustrate OpenAPI concepts" | |
}, | |
"servers": [ | |
{ | |
"url": "https://example.io/v1" | |
} | |
], | |
"paths": { | |
"/artists": { | |
"get": { | |
"description": "Returns a list of artistss", | |
"parameters": [ | |
{ | |
"$ref": "#/components/parameters/PageLimit" | |
}, | |
{ | |
"$ref": "#/components/parameters/PageOffset" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Successfully returned a list of artists", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Artist" | |
} | |
} | |
} | |
} | |
}, | |
"400": { | |
"$ref": "#/components/responses/400Error" | |
} | |
} | |
}, | |
"post": { | |
"description": "Lets a user post a new artist", | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Artist" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"200": { | |
"description": "Successfully created a new artist" | |
}, | |
"400": { | |
"$ref": "#/components/responses/400Error" | |
} | |
} | |
} | |
}, | |
"/artists/{username}": { | |
"get": { | |
"description": "Obtain information about an artist from his or her unique username", | |
"parameters": [ | |
{ | |
"name": "username", | |
"in": "path", | |
"required": true, | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Successfully returned an artist", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "object", | |
"properties": { | |
"artist_name": { | |
"type": "string" | |
}, | |
"artist_genre": { | |
"type": "string" | |
}, | |
"albums_recorded": { | |
"type": "integer" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"400": { | |
"$ref": "#/components/responses/400Error" | |
} | |
} | |
} | |
} | |
}, | |
"components": { | |
"securitySchemes": { | |
"Authorization": { | |
"type": "apiKey", | |
"in": "header", | |
"name": "Authorization" | |
} | |
}, | |
"schemas": { | |
"Artist": { | |
"type": "object", | |
"required": [ | |
"username" | |
], | |
"properties": { | |
"artist_name": { | |
"type": "string" | |
}, | |
"artist_genre": { | |
"type": "string" | |
}, | |
"albums_recorded": { | |
"type": "integer" | |
}, | |
"username": { | |
"type": "string" | |
} | |
} | |
} | |
}, | |
"parameters": { | |
"PageLimit": { | |
"name": "limit", | |
"in": "query", | |
"description": "Limits the number of items on a page", | |
"schema": { | |
"type": "integer" | |
} | |
}, | |
"PageOffset": { | |
"name": "offset", | |
"in": "query", | |
"description": "Specifies the page number of the artists to be displayed", | |
"schema": { | |
"type": "integer" | |
} | |
} | |
}, | |
"responses": { | |
"400Error": { | |
"description": "Invalid request", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "object", | |
"properties": { | |
"message": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment