Skip to content

Instantly share code, notes, and snippets.

@kevee
Last active May 13, 2020 10:00
Show Gist options
  • Save kevee/0df724a24b0384d44e0532d928a36e53 to your computer and use it in GitHub Desktop.
Save kevee/0df724a24b0384d44e0532d928a36e53 to your computer and use it in GitHub Desktop.
OpenAPI sample spec
{
"openapi": "3.0.0",
"info": {
"title": "COVID Tracking Project API",
"version": "1.0"
},
"servers": [
{
"url": "https://covidtracking.com",
"x-is-public": true
},
{
"url": "https://secret-api-internal.org",
"x-is-public": false
}
],
"paths": {
"/api/v1/states/daily.{format}": {
"get": {
"tags": [
"States Current and Historical Data"
],
"x-is-public": true,
"description": "States historical data.",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/States"
}
}
},
"text/csv": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/States"
}
}
}
}
}
},
"parameters": [
{
"name": "format",
"in": "path",
"required": true,
"style": "simple",
"explode": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "Use 'json' to return JSON arrays or object. Use 'csv' to return a CSV file."
}
]
}
}
},
"components": {
"schemas": {
"States": {
"type": "object",
"properties": {
"date": {
"type": "integer",
"description": "Date of this record",
"nullable": false,
"example": 20200501,
"x-graphql-type": "Int",
"x-source": {
"spreadsheet": true,
"worksheet-id": "1234",
"tab-id": "1234",
"tab-name": "Worksheet2",
"column-name": "Date"
},
"x-date": {
"format": "yyyyLLdd"
}
},
"state": {
"type": "string",
"description": "The two-letter state code",
"nullable": false,
"example": "AK",
"x-graphql-type": "String",
"x-source": {
"spreadsheet": true,
"worksheet-id": "1234",
"tab-id": "1234",
"tab-name": "Worksheet2",
"column-name": "State ID"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment