Skip to content

Instantly share code, notes, and snippets.

@mlesaout
Created March 10, 2023 09:59
Show Gist options
  • Save mlesaout/201ad8efbc3e04c0d3bab3737ab4e1c4 to your computer and use it in GitHub Desktop.
Save mlesaout/201ad8efbc3e04c0d3bab3737ab4e1c4 to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: Hashicups
description: Products API allows access to HashiCoffee Coffees and Ingredients
version: 1.0.0
servers:
- url: http://{{baseurl}}
components:
securitySchemes:
noauthAuth:
type: http
scheme: noauth
oauth2Auth:
type: http
scheme: oauth2
security:
- oauth2Auth: []
tags:
- name: coffees
- name: health
- name: orders
paths:
/coffees:
get:
tags:
- coffees
summary: Returns a list of Coffee
parameters:
- name: Accept
in: header
schema:
type: string
example: application/json
responses:
'200':
description: OK
headers:
Content-Type:
schema:
type: string
example: application/json
content:
application/json:
schema:
type: object
example:
- id: 1
name: Latte
price: 2.34
created_at: {}
updated_at: {}
deleted_at: {}
ingredients:
- -54733593
- -67967289
- id: 1
name: Latte
price: 2.34
created_at: {}
updated_at: {}
deleted_at: {}
ingredients:
- 8508782
- 10627636
/coffees/{id}/ingredients:
get:
tags:
- coffees
summary: Returns a list of ingredients for a coffee
parameters:
- name: Accept
in: header
schema:
type: string
example: application/json
- name: id
in: path
schema:
type: string
required: true
responses:
'200':
description: OK
headers:
Content-Type:
schema:
type: string
example: application/json
content:
application/json:
schema:
type: object
example:
- id: 1
name: Milk
quantity: 500ml
created_at: {}
updated_at: {}
deleted_at: {}
- id: 1
name: Milk
quantity: 500ml
created_at: {}
updated_at: {}
deleted_at: {}
/coffees/{id}:
get:
tags:
- coffees
summary: Returns coffee id details
parameters:
- name: Accept
in: header
schema:
type: string
example: application/json
- name: id
in: path
schema:
type: integer
required: true
example: '1'
responses:
'200':
description: OK
headers:
Content-Type:
schema:
type: string
example: application/json
content:
application/json:
schema:
type: object
example:
- id: 1
name: Milk
quantity: 500ml
created_at: {}
updated_at: {}
deleted_at: {}
- id: 1
name: Milk
quantity: 500ml
created_at: {}
updated_at: {}
deleted_at: {}
/health:
get:
tags:
- health
summary: readyz
security:
- noauthAuth: []
responses:
'200':
description: Successful response
content:
application/json: {}
/orders:
get:
tags:
- orders
summary: Get orders
parameters:
- name: Accept
in: header
schema:
type: string
example: application/json
responses:
'200':
description: Successful response
content:
application/json: {}
post:
tags:
- orders
summary: Create order
requestBody:
content:
'*/*':
schema:
type: string
example: >-
"[\r\n {\r\n \"coffee\": {\r\n \"id\":
1\r\n },\r\n \"quantity\": 2\r\n },\r\n
{\r\n \"coffee\": {\r\n \"id\": 2\r\n
},\r\n \"quantity\": 3\r\n }\r\n]"
parameters:
- name: Content-Type
in: header
schema:
type: string
example: application/json
responses:
'200':
description: Successful response
content:
application/json: {}
/orders/{id}:
get:
tags:
- orders
summary: Get order by id
parameters:
- name: Content-Type
in: header
schema:
type: string
example: application/json
- name: id
in: path
schema:
type: integer
required: true
example: '11'
responses:
'200':
description: Successful response
content:
application/json: {}
put:
tags:
- orders
summary: Modify order
requestBody:
content:
'*/*':
schema:
type: string
example: >-
"[\r\n {\r\n \"coffee\": {\r\n \"id\":
1,\r\n \"name\": \"Latte\"\r\n },\r\n
\"quantity\": 3\r\n },\r\n {\r\n \"coffee\":
{\r\n \"id\": 2,\r\n \"name\":
\"Americano\"\r\n },\r\n \"quantity\": 3\r\n
}\r\n]"
parameters:
- name: Content-Type
in: header
schema:
type: string
example: application/json
- name: id
in: path
schema:
type: integer
required: true
example: '10'
responses:
'200':
description: Successful response
content:
application/json: {}
delete:
tags:
- orders
summary: Delete order
parameters:
- name: Content-Type
in: header
schema:
type: string
example: application/json
- name: id
in: path
schema:
type: integer
required: true
example: '10'
responses:
'200':
description: Successful response
content:
application/json: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment