Created
March 27, 2019 18:56
-
-
Save samuelsolis/79111cbeda02276279dffbcb36b60596 to your computer and use it in GitHub Desktop.
OpenApi Example
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: | |
description: "This is a sample documentatio for de Color API." | |
version: "1.0.0" | |
title: "Swagger Color Management" | |
contact: | |
email: "example@example.com" | |
license: | |
name: "Apache 2.0" | |
url: "http://www.apache.org/licenses/LICENSE-2.0.html" | |
host: "example.local" | |
basePath: "/v1" | |
schemes: | |
- "https" | |
- "http" | |
paths: | |
/colors: | |
get: | |
tags: | |
- "color" | |
summary: "Get all colors" | |
description: "Get all saved colors." | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
responses: | |
200: | |
description: "Success" | |
405: | |
description: "Invalid input" | |
/color: | |
post: | |
tags: | |
- "color" | |
summary: "Add a new color" | |
description: "Add a new color. Hex is the identifier, cannot be duplicated." | |
operationId: "AddColor" | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
parameters: | |
- in: "body" | |
name: "body" | |
description: "Color managed in the app." | |
required: true | |
schema: | |
$ref: "#/definitions/Color" | |
responses: | |
405: | |
description: "Invalid input" | |
200: | |
description: "Success" | |
/color/{hex}: | |
patch: | |
tags: | |
- "color" | |
summary: "Update an existing color" | |
operationId: "updateColor" | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
parameters: | |
- name: "hex" | |
in: "path" | |
description: "ID of color that needs to be fetched" | |
required: true | |
type: "string" | |
format: "int64" | |
- in: "body" | |
name: "body" | |
description: "Color managed in the app." | |
required: true | |
schema: | |
$ref: "#/definitions/Color" | |
responses: | |
405: | |
description: "Invalid input" | |
delete: | |
tags: | |
- "color" | |
summary: "Delete an existing color" | |
operationId: "deleteColor" | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
parameters: | |
- name: "hex" | |
in: "path" | |
description: "ID of color that needs to be fetched" | |
required: true | |
type: "string" | |
format: "int64" | |
responses: | |
405: | |
description: "Invalid input" | |
definitions: | |
Color: | |
type: "object" | |
required: | |
- "hex" | |
properties: | |
hex: | |
type: "string" | |
example: "#101014" | |
name: | |
type: "string" | |
example: "red" | |
price: | |
type: "integer" | |
format: "int64" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment