-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForecast.v1.yaml
213 lines (213 loc) · 5.46 KB
/
Forecast.v1.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
openapi: 3.0.0
info:
title: Forecast
version: '1.0'
description: Set and read forecast for specific city.
contact:
name: Jurica Separoic
url: separovic.dev
email: jurica.separovic@gmail.com
servers:
- url: 'http://forecaster.com'
description: Forecaster
paths:
'/api/v3/cities/{id}/forecasts':
parameters:
- schema:
type: string
name: id
in: path
description: City id
required: true
get:
summary: Get city forecast
tags: []
operationId: get-api-v3-cities-id-forecast
description: Get forecast for specificy city
parameters:
- schema:
type: string
format: date
example: '2020-11-19'
in: query
name: date
description: Get city forecast for specific date
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
description: ''
minItems: 1
uniqueItems: true
items:
$ref: '#/components/schemas/Forecast'
examples:
Two day forecast for city:
value:
- id: 299bee2f-bbf9-41f2-8b32-010482c6c8f5
day: '2020-11-19'
temperature:
celsius: 24
fahrenheit: 75.2
- id: 123123-bbf9-41f2-8b32-010482c6c8f5
day: '2020-12-19'
temperature:
celsius: 25
fahrenheit: 76.2
post:
summary: Add city forecast
operationId: post-api-v3-cities-id-forecast
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateForecastRequest'
examples:
Temperature for 19th of November:
value:
date: '2020-11-19'
temperature:
celsius: 24
fahrenheit: 75.2
description: ''
description: Add forecast for specific city.
responses:
'201':
description: Forecast created
headers: {}
content:
application/json:
schema:
type: object
examples:
Creation success:
value: {}
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationFailedResponse'
examples: {}
components:
schemas:
CreateForecastRequest:
description: Add forecast reuquest
type: object
properties:
date:
type: string
minLength: 1
temperature:
type: object
properties:
celsius:
type: number
fahrenheit:
type: number
required:
- celsius
- fahrenheit
required:
- date
- temperature
x-examples:
Create forecast for 11th of November:
date: '2020-11-19'
temperature:
celsius: 24
fahrenheit: 75.2
title: Add forecast request
ValidationFailedResponse:
description: ''
type: object
x-examples:
Invalid input field:
title: Unprocessable Entity
type: 'https://httpstatus.es/422'
status: 422
detail: Input validation failed.
validation_failures:
- id: email
message: This field is not a valid email address.
value: h4ck3r@@mail
properties:
title:
type: string
minLength: 1
description: Exception title
enum:
- Unprocessable Entity
type:
type: string
minLength: 1
enum:
- 'https://httpstatus.es/422'
status:
type: number
enum:
- 422
detail:
type: string
minLength: 1
enum:
- Input validation failed.
validation_failures:
type: array
uniqueItems: true
minItems: 1
items:
type: object
properties:
message:
type: string
minLength: 1
value:
type: string
id:
type: string
required:
- message
- value
required:
- title
- type
- status
- detail
- validation_failures
Forecast:
description: ''
type: object
x-examples:
Forecast for 11th of November:
id: 299bee2f-bbf9-41f2-8b32-010482c6c8f5
day: '2020-11-19'
temperature:
celsius: 24
fahrenheit: 75.2
properties:
id:
type: string
minLength: 1
date:
type: string
minLength: 1
temperature:
type: object
required:
- celsius
- fahrenheit
properties:
celsius:
type: number
fahrenheit:
type: number
required:
- id
- date
- temperature
securitySchemes: {}