Skip to content

Instantly share code, notes, and snippets.

@mor10
Last active January 11, 2024 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mor10/6fb15f2270f8ac1d8b99aa66f9b63410 to your computer and use it in GitHub Desktop.
Save mor10/6fb15f2270f8ac1d8b99aa66f9b63410 to your computer and use it in GitHub Desktop.
OpenWeather OpenAPI schema
{
"openapi": "3.1.0",
"info": {
"title": "OpenWeatherMap One Call API",
"description": "Provides access to current weather, hourly forecast, and daily forecast data.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://api.openweathermap.org"
}
],
"paths": {
"/data/2.5/weather": {
"get": {
"description": "Retrieve current weather, hourly forecast, and daily forecast based on latitude and longitude.",
"operationId": "getWeatherData",
"parameters": [
{
"name": "lat",
"in": "query",
"required": true,
"description": "Latitude of the location.",
"schema": {
"type": "number"
}
},
{
"name": "lon",
"in": "query",
"required": true,
"description": "Longitude of the location.",
"schema": {
"type": "number"
}
},
{
"name": "appid",
"in": "query",
"required": true,
"description": "API key for authentication.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response with weather data.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WeatherResponse"
}
}
}
},
"401": {
"description": "Unauthorized due to missing or invalid API key."
}
}
}
}
},
"components": {
"schemas": {
"WeatherResponse": {
"type": "object",
"properties": {
"current": {
"type": "object",
"properties": {
"lat": {
"type": "number"
},
"lon": {
"type": "number"
},
"tz": {
"type": "string"
},
"date": {
"type": "string",
"format": "date"
},
"units": {
"type": "string"
},
"cloud_cover": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"humidity": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"precipitation": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
}
},
"temperature": {
"type": "object",
"properties": {
"min": { "type": "number" },
"max": { "type": "number" },
"afternoon": { "type": "number" },
"night": { "type": "number" },
"evening": { "type": "number" },
"morning": { "type": "number" }
}
},
"pressure": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"wind": {
"type": "object",
"properties": {
"max": {
"type": "object",
"properties": {
"speed": { "type": "number" },
"direction": { "type": "integer" }
}
}
}
}
}
},
"hourly": {
"type": "array",
"items": {
"type": "object",
"properties": {
"lat": {
"type": "number"
},
"lon": {
"type": "number"
},
"tz": {
"type": "string"
},
"date": {
"type": "string",
"format": "date"
},
"units": {
"type": "string"
},
"cloud_cover": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"humidity": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"precipitation": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
}
},
"temperature": {
"type": "object",
"properties": {
"min": { "type": "number" },
"max": { "type": "number" },
"afternoon": { "type": "number" },
"night": { "type": "number" },
"evening": { "type": "number" },
"morning": { "type": "number" }
}
},
"pressure": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"wind": {
"type": "object",
"properties": {
"max": {
"type": "object",
"properties": {
"speed": { "type": "number" },
"direction": { "type": "integer" }
}
}
}
}
}
}
},
"daily": {
"type": "array",
"items": {
"type": "object",
"properties": {
"lat": {
"type": "number"
},
"lon": {
"type": "number"
},
"tz": {
"type": "string"
},
"date": {
"type": "string",
"format": "date"
},
"units": {
"type": "string"
},
"cloud_cover": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"humidity": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"precipitation": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
}
},
"temperature": {
"type": "object",
"properties": {
"min": { "type": "number" },
"max": { "type": "number" },
"afternoon": { "type": "number" },
"night": { "type": "number" },
"evening": { "type": "number" },
"morning": { "type": "number" }
}
},
"pressure": {
"type": "object",
"properties": {
"afternoon": {
"type": "integer"
}
}
},
"wind": {
"type": "object",
"properties": {
"max": {
"type": "object",
"properties": {
"speed": { "type": "number" },
"direction": { "type": "integer" }
}
}
}
}
}
}
}
}
}
}
},
"securitySchemes": {
"apiKeyAuth": {
"type": "apiKey",
"in": "query",
"name": "appid"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment