Skip to content

Instantly share code, notes, and snippets.

@sachi-d
Last active February 18, 2020 04:42
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 sachi-d/0f2c0af614723aab0c30095fdfcbe93c to your computer and use it in GitHub Desktop.
Save sachi-d/0f2c0af614723aab0c30095fdfcbe93c to your computer and use it in GitHub Desktop.
Weather App Files
swagger: "2.0"
info:
description: "This is a sample weather forecast server."
version: "1.0.0"
title: "Weather Forecast"
host: "localhost:3000"
schemes:
- "https"
- "http"
tags:
- name: weather
- name: util
paths:
/conditions:
get:
summary: "Retrieve list of available weather conditions"
description: "Retrieve list of available weather conditions"
tags:
- util
produces:
- "application/json"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Condition"
/locations:
get:
summary: "Retrieve list of locations that can be forecasted ordered alphabetically by the city"
description: "Retrieve list of locations that can be forecasted"
tags:
- util
produces:
- "application/json"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Locations"
/forecasts:
get:
summary: "Retrieve weather forecast of a city"
description: "Retrieve weather forecast for a particular city for 10 upcoming days"
tags:
- weather
produces:
- "application/json"
parameters:
- name: "location"
in: "query"
description: "Comma separated values should represent the city, region and the country of the requested location. Eg: /forecast?location=Mountain+View,California,USA"
required: true
type: "string"
- name: "limit"
in: "query"
description: "Number of forecast items required"
default: 10
required: false
type: "integer"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Forecasts"
400:
description: "Invalid city value"
definitions:
Locations:
type: "array"
description: "List of locations ordered by the city"
items:
$ref: "#/definitions/LocationItem"
LocationItem:
type: "object"
properties:
id:
type: "string"
description: "Unique identifier of the location"
example: "6"
city:
type: "string"
description: "Name of the city"
example: "Mountain View"
region:
type: "string"
description: "Name of the region"
example: "California"
country:
type: "string"
description: "Name of the country"
example: "USA"
lat:
type: "string"
description: "The latitude of the location"
example: "234"
long:
type: "string"
description: "The longitude of the location"
example: "35"
xml:
name: "Category"
Forecasts:
type: "array"
description: "List of forecasts ordered by the forecasted date"
items:
$ref: "#/definitions/ForecastItem"
Condition:
type: "object"
properties:
id:
type: "string"
description: "Unique identifier of the condition"
example: "2"
name:
type: "string"
description: "Name of the condition"
example: "Thunderstorm"
ForecastItem:
type: "object"
properties:
date:
type: "number"
description: "Unix timestamp of the forecasted date"
example: "1580301692118"
low:
type: "number"
description: "The forecasted low temperature for this day, in Celcius"
high:
type: "number"
description: "The forecasted high temperature for this day, in Celcius"
avg:
type: "number"
description: "The forecasted average temperature for this day, in Celcius"
conditionName:
type: "string"
description: "The name of the weather condition as listed"
example: "Thunderstorm"
conditionCode:
type: "string"
description: "The code of the weather condition as listed"
example: "4"
windChill:
type: "integer"
description: "wind chill in degrees"
example: "60"
windDirection:
type: "integer"
description: "wind direction, in degrees"
example: "160"
windSpeed:
type: "integer"
description: "wind speed in km/h"
example: "10"
atmosphereHumidity:
type: "number"
description: "humidity, in percentage"
example: "15"
atmosphereVisibility:
type: "number"
description: "visibility in km"
example: "19"
atmospherePressure:
type: "number"
description: "barometric pressure in hPa"
example: "20"
sunrise:
type: "string"
example: "06:22:00"
description: "The timestamp of the predicted sunrise in the format hh:mm:ss"
sunset:
type: "string"
example: "19:12:00"
description: "The timestamp of the predicted sunset in the format hh:mm:ss"
publishedDate:
type: "string"
description: "Unix timestamp of the published date"
example: "1580301692118"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment