-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.yaml
More file actions
267 lines (267 loc) · 6.98 KB
/
swagger.yaml
File metadata and controls
267 lines (267 loc) · 6.98 KB
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Authserver API
description: An authorization server to generate and validate JWT token
version: "4.0.0"
# the domain of the service
#host: api.uber.com
# array of all schemes that your API supports
schemes:
- https
- http
# will be prefixed to all paths
#basePath: /v1
produces:
- application/json
paths:
/tokens/validate:
get:
summary: Validate JWT
parameters:
- name: "Authorization: BEARER"
in: header
description: JWT(json web tokn).
required: true
type: string
tags:
- Validate
responses:
200:
description: jwt is valid
500:
description: jwt is absent or invalid
schema:
$ref: '#/definitions/HTTPError'
/tokens/{provider}:
post:
summary: Generates a JWT in exchange of oauth code
parameters:
- name: client_id
in: query
description: |
The client ID you received during application registration
from every provider.
required: true
type: string
- name: scopes
in: query
description: Scope of the application.
required: true
type: string
- name: state
in: query
description: |
An unguessable random string. It is used to protect against cross-site request forgery attacks. It is passed to the provider during first login.
required: true
type: string
- name: redirect_url
in: query
description: |
The URL in your application where users will be sent after authorization,
generally provided during the registration of the application.
required: true
type: string
- name: code
in: query
description: |
The code that is received as response from the first login.
required: true
type: string
- name: provider
in: path
description: Third party oauth provider.
required: true
type: string
enum: [google, facebook, linkedin, orcid]
tags:
- Provider
responses:
200:
description: Return a jwt with user information.
schema:
$ref: '#/definitions/AuthUser'
401:
description: Invalid credentials
schema:
$ref: '#/definitions/HTTPError'
500:
description: Various internal server errors
schema:
$ref: '#/definitions/HTTPError'
definitions:
AuthUser:
type: object
properties:
token:
type: string
description: JWT(json web token)
identity:
$ref: '#/definitions/Identity'
user:
$ref: '#/definitions/User'
ErrorSource:
type: object
properties:
pointer:
type: string
description: A resource url that is the cause of the error
parameter:
type: string
description: Query parameter of the resource url
Error:
type: object
properties:
status:
type: string
description: HTTP status
title:
type: string
description: Short title of the error
detail:
type: string
description: Detail description of the error
source:
$ref: "#/definitions/ErrorSource"
meta:
description: Arbitary key value data related to error
type: object
additionalProperties:
type: string
HTTPError:
type: object
properties:
errors:
type: array
items:
$ref: "#/definitions/Error"
Identity:
type: object
properties:
data:
$ref: '#/definitions/IdentityData'
links:
$ref: '#/definitions/jsonapiLinks'
IdentityAttributes:
type: object
properties:
identifier:
type: string
description: |
An unique identifier provided by the third party.
Generally it's an email id, however it could be something else
specifically provided by an provider.
provider:
type: string
description: 'Name of the provider, for example, orcid, google, facebook etc.'
user_id:
type: string
format: int64
description: |
The id of the user to which this identity is connected.
This id could be used to fetch a complete user response from the user
service
created_at:
type: string
format: date-time
description: Timestamp for creation
updated_at:
type: string
format: date-time
description: Timestamp for update
IdentityData:
type: object
properties:
type:
type: string
description: The resource name
id:
type: string
format: int64
description: Unique id
attributes:
$ref: '#/definitions/IdentityAttributes'
links:
$ref: '#/definitions/jsonapiLinks'
jsonapiLinks:
type: object
properties:
self:
type: string
description: A http link. It points to the resource itself.
related:
type: string
description: A http link. It points to a related resource.
User:
type: object
properties:
data:
$ref: '#/definitions/UserData'
links:
$ref: '#/definitions/jsonapiLinks'
UserAttributes:
type: object
properties:
first_name:
type: string
description: First name.
last_name:
type: string
description: Last name.
email:
type: string
description: Email.
organization:
type: string
description: Organization in which the user belong.
group_name:
type: string
description: Group in which the user belong.
first_address:
type: string
description: Address.
second_address:
type: string
description: More address.
city:
type: string
description: City.
state:
type: string
description: State.
zipcode:
type: string
description: Zipcode.
country:
type: string
description: Country.
phone:
type: string
description: Phone no.
is_active:
type: boolean
format: boolean
description: Current status of user.
created_at:
type: string
format: date-time
description: Timestamp for creation.
updated_at:
type: string
format: date-time
description: Timestamp for update.
UserData:
type: object
properties:
type:
type: string
description: The resource name.
id:
type: string
format: int64
description: Unique id.
attributes:
$ref: '#/definitions/UserAttributes'
links:
$ref: '#/definitions/jsonapiLinks'