Skip to content

Instantly share code, notes, and snippets.

@evanshortiss
Created October 10, 2019 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanshortiss/4a242eb0ed39980976ed0b13c69e4c43 to your computer and use it in GitHub Desktop.
Save evanshortiss/4a242eb0ed39980976ed0b13c69e4c43 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.2",
"info": {
"title": "orders-internal",
"description": "This is an internal API that exposes order entries contained in the system.",
"version": "1.0.0"
},
"paths": {
"/orders": {
"description": "Used to interact with orders stored in the backing data store.",
"get": {
"summary": "Returns all orders from the underlying data store.",
"operationId": "get-all-orders",
"responses": {
"200": {
"description": "Indicates that the request was processed successfully and existing orders are contained in the response body.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Order"
}
},
"examples": {
"All Orders Sample Response": {
"value": [
{
"message_id": "frontend-nodejs-ea12/0",
"datetime": "2019-10-07T17:18:08.487Z",
"product": "Engine",
"quantity": 1
},
{
"message_id": "frontend-nodejs-ea12/1",
"datetime": "2019-10-07T17:18:10.177Z",
"product": "Shocks",
"quantity": 2
}
]
}
}
}
}
}
}
},
"post": {
"summary": "Create an order.",
"operationId": "create-order",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Order"
},
"examples": {
"Create Order Example": {
"value": {
"product": "Engine",
"quantity": 1,
"message_id": "frontend/nodejs-ee21",
"datetime": "2019-10-08T19:23:33.077Z"
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "The successful resposne upon creating an order."
}
}
}
}
},
"components": {
"schemas": {
"Order": {
"title": "Root Type for Order",
"description": "An order object containing the product name, quantity ordered, timestamp representing when the order was placed, and the message queue transaction/payload ID.",
"type": "object",
"properties": {
"product": {
"type": "string"
},
"quantity": {
"format": "int32",
"type": "integer"
},
"datetime": {
"format": "date-time",
"type": "string"
},
"message_id": {
"type": "string"
}
},
"example": {
"product": "Engine",
"quantity": 1,
"datetime": "2019-10-07T17:18:08.487Z",
"message_id": "frontend-nodejs-ea12/0"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment