-
-
Save AnanthaRajuC/e47660c87fe799f2ed1e24092e9a9cca to your computer and use it in GitHub Desktop.
OpenAPI3.yaml
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 | |
security: | |
- BasicAuth: [] | |
paths: | |
/artists: | |
get: | |
description: Returns a list of artists | |
parameters: | |
# ----- Added line ------------------------------------------ | |
- $ref: "#/components/parameters/PageLimit" | |
- $ref: "#/components/parameters/PageOffset" | |
# ---- /Added line ------------------------------------------ | |
responses: | |
"200": | |
description: Successfully returned a list of artists | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
# ----- Added line -------------------------------- | |
$ref: "#/components/schemas/Artist" | |
# ---- /Added line -------------------------------- | |
"400": | |
# ----- Added line ---------------------------------------- | |
$ref: "#/components/responses/400Error" | |
# ---- /Added line ---------------------------------------- | |
post: | |
description: Lets a user post a new artist | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
# ----- Added line ------------------------------------ | |
$ref: "#/components/schemas/Artist" | |
# ---- /Added line ------------------------------------ | |
responses: | |
"200": | |
description: Successfully created a new artist | |
"400": | |
# ----- Added line ---------------------------------------- | |
$ref: "#/components/responses/400Error" | |
# ---- /Added line ---------------------------------------- | |
/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": | |
# ----- Added line ---------------------------------------- | |
$ref: "#/components/responses/400Error" | |
# ---- /Added line ---------------------------------------- | |
components: | |
securitySchemes: | |
BasicAuth: | |
type: http | |
scheme: basic | |
schemas: | |
Artist: | |
type: object | |
required: | |
- username | |
properties: | |
artist_name: | |
type: string | |
artist_genre: | |
type: string | |
albums_recorded: | |
type: integer | |
username: | |
type: string | |
# ----- Added lines ---------------------------------------- | |
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 | |
# ---- /Added lines ---------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment