-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.yml
217 lines (211 loc) · 6.13 KB
/
api.yml
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
openapi: "3.0.0"
info:
version: 1.0.0
title: Harver Candidate API (QA Exercise)
description: This API provides basic CRUD operations for a Candidate resource. Users must be authorized
with basic authentication for all non-read operations.
paths:
/candidates:
get:
description:
Lists all candidates in the system. Anonymous users may view this path.
operationId: getCandidates
responses:
'200':
description: Successful response, a list of candidates
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Candidate'
post:
description: Creates a new candidate. You must be authorized to use this path.
operationId: createCandidate
security:
- basicAuth: []
requestBody:
description: New candidate data; first name, last name, matching score and vacancy applied for.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostCandidate'
example: { "firstName": "Donald", "lastName": "Trump", "matchingScore": 3, "vacancyTitle": 'President' }
responses:
'201':
description: Provides the newly created candidate resource.
content:
application/json:
schema:
$ref: '#/components/schemas/Candidate'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/candidates/{id}:
get:
description: Find a candidate by their ID. Anonymous users may use this path.
operationId: getCandidateForId
parameters:
- name: id
in: path
description: ID of the candidate to get
required: true
schema:
type: string
responses:
'200':
description: Provides the candidate resource.
content:
application/json:
schema:
$ref: '#/components/schemas/Candidate'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
description: Update a candidate's data, this request may not include an ID. You must be authorized to use this path.
operationId: updateCandidate
security:
- basicAuth: []
requestBody:
description: New candidate data
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PutCandidate'
example: { "firstName": "Boris", "lastName": "Johnson", "matchingScore": 2, "vacancyTitle": 'Prime Minister' }
responses:
'200':
description: Provides the updated candidate resource.
content:
application/json:
schema:
$ref: '#/components/schemas/Candidate'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
patch:
description: Apply changes to a candidate's data, this request may not include an ID. You must be authorized to use this path.
security:
- basicAuth: []
operationId: patchCandidate
requestBody:
description: Candidate updates to patch
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatchCandidate'
example: { "vacancyTitle": 'Charlatan' }
responses:
'200':
description: Provides the updated candidate resource.
content:
application/json:
schema:
$ref: '#/components/schemas/Candidate'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
description: Deletes a single candidate based on the given ID. You must be authorized to use this path.
security:
- basicAuth: []
operationId: deleteCandidate
parameters:
- name: id
in: path
description: ID of candidate to delete
required: true
schema:
type: string
responses:
'204':
description: Candidate deleted
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Candidate:
type: object
properties:
id:
type: string
firstName:
type: string
lastName:
type: string
matchingScore:
type: integer
format: int32
vacancyTitle:
type: string
CandidateBody:
type: object
properties:
firstName:
type: string
lastName:
type: string
matchingScore:
type: integer
format: int32
minimum: 0
maximum: 100
vacancyTitle:
type: string
additionalProperties: false
PostCandidate:
$ref: '#/components/schemas/CandidateBody'
required:
- firstName
- lastName
- matchingScore
- vacancyTitle
PutCandidate:
$ref: '#/components/schemas/CandidateBody'
required:
- firstName
- lastName
- matchingScore
- vacancyTitle
PatchCandidate:
$ref: '#/components/schemas/CandidateBody'
Error:
required:
- status
- message
properties:
status:
type: integer
format: int32
message:
type: string
securitySchemes:
basicAuth:
type: http
scheme: basic