Skip to content

Instantly share code, notes, and snippets.

@lbrenman
Created March 22, 2022 14:56
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 lbrenman/6e0fbd724cb6b351198467eaf1595195 to your computer and use it in GitHub Desktop.
Save lbrenman/6e0fbd724cb6b351198467eaf1595195 to your computer and use it in GitHub Desktop.
OAS3 Stock Watchlist API Definition (Stoplight export)
{
"openapi": "3.0.0",
"info": {
"title": "watchlist",
"version": "1.0",
"contact": {
"name": "Leor Brenman"
},
"description": "Stock Watch List API"
},
"servers": [
{
"url": "http://localhost:3000"
}
],
"paths": {
"/watchlist": {
"get": {
"summary": "Your GET endpoint",
"tags": [
"Watch List"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Quote"
}
},
"examples": {
"example-1": {
"value": [
{
"symbol": "TXN",
"lastPrice": 174.74,
"change": 2.4199982
},
{
"symbol": "AAPL",
"lastPrice": 157.58,
"change": 2.4900055
}
]
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "string"
},
"examples": {
"example-1": {
"value": "Error"
}
}
}
}
}
},
"operationId": "get-watchlist",
"description": "Stock Watch List API",
"parameters": [
{
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"in": "query",
"explode": false,
"name": "stocklist",
"description": "Comma separated list of stock symbols (e.g. aapl,txn,amzn)",
"required": true,
"style": "form"
}
]
}
}
},
"components": {
"schemas": {
"Quote": {
"title": "quote",
"type": "object",
"x-tags": [
"stock quote"
],
"properties": {
"symbol": {
"type": "string"
},
"lastPrice": {
"type": "number"
},
"change": {
"type": "number"
}
}
}
},
"securitySchemes": {}
},
"tags": [
{
"name": "Watch List"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment