This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
510 lines (493 loc) · 14.6 KB
/
swagger.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
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
swagger: "2.0"
info:
description: "
The repository manager can be used to manage artifacts and to get an overview of existing artifacts from the build-pipeline.
To use this API a token is required. This token can be generated by the *authentication/generate-token* API.
Users can be managed with the */users* API. For this API is a token with ADMIN privileges required.
To create new entries of new artifact versions, the */repositories* API is provided.
"
version: "1.0"
title: "Repository Manager API"
termsOfService: "http://swagger.io/terms/"
contact:
email: "joerg.flade@l-und-f.de"
license:
name: "MIT"
url: "https://opensource.org/licenses/MIT"
host: "localhost:9090"
basePath: "/v1"
tags:
- name: "user"
description: "User management API"
- name: "authentication"
description: "Access to the RepoMgr"
- name: "repository"
description: "Operative API to handle the artifacts"
schemes:
- "https"
- "http"
paths:
/repositories:
post:
tags:
- "repository"
summary: "Store new version information"
description: "Store information of a new version from CI/CD process"
operationId: "pushNewVersion"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Information about the new version."
required: true
schema:
$ref: '#/definitions/VersionInformation'
responses:
201:
description: "Successful stored"
schema:
$ref: '#/definitions/Response'
400:
description: "Invalid input or error."
schema:
$ref: '#/definitions/Response'
401:
description: "Unauthorized"
schema:
$ref: '#/definitions/Error'
403:
description: "Forbidden. User must have scope *ROLE_USER* or *ROLE_ADMIN*"
security:
- Bearer: []
/repositories/search:
post:
tags:
- "repository"
summary: "List repository data"
description: "List artifacts at repository with additional filter options"
operationId: "listVersionInformation"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "query"
name: sortField
type: string
description: "Field to sort to"
- in: "query"
name: sortDirection
type: string
enum:
- ASC
- DESC
description: "Field to sort to"
- in: "query"
name: page
type: integer
description: "The page to show. (*Default is 1*)"
- in: "query"
name: size
type: integer
description: "Size of page elements. (*Default is 10*)"
- in: "body"
name: "body"
description: "Credentials to authenticate."
required: true
schema:
$ref: '#/definitions/VersionInformationFilter'
responses:
200:
description: "Successful stored"
schema:
$ref: '#/definitions/VersionInformationContainer'
400:
description: "Invalid input or error."
schema:
$ref: '#/definitions/Response'
/authentication/generate-token:
post:
tags:
- "authentication"
summary: "Authenticate and get token"
description: "User can authenticate to get a new token"
operationId: "generateToken"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Credentials to authenticate."
required: true
schema:
$ref: '#/definitions/Credentials'
responses:
200:
description: "successful authenticated and token generated"
schema:
$ref: '#/definitions/Token'
401:
description: "Unauthorized. Wrong credentials"
schema:
$ref: '#/definitions/Response'
/users:
post:
tags:
- "user"
summary: "Add a new user"
description: "Add a new user or project"
operationId: "storeUser"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "User information to store"
required: true
schema:
$ref: "#/definitions/User"
responses:
201:
description: "If user was successful stored, the response contains a valid status and the userId (UUID) for further communications."
schema:
$ref: '#/definitions/UserResponse'
400:
description: "Invalid input or error."
schema:
$ref: '#/definitions/Response'
401:
description: "Unauthorized"
schema:
$ref: '#/definitions/Error'
403:
description: "Forbidden. User must have scope *ROLE_ADMIN*"
security:
- Bearer: []
/users/{userId}/password:
put:
tags:
- "user"
summary: "Update password of an existing user"
description: ""
operationId: "updateUserPassword"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "path"
name: userId
type: string
required: true
- in: "body"
name: "body"
description: "The new password."
required: true
schema:
$ref: "#/definitions/Password"
responses:
200:
description: "Returns userId and valid status"
schema:
$ref: '#/definitions/UserResponse'
400:
description: "Unable to update password."
schema:
$ref: '#/definitions/Response'
401:
description: "Unauthorized"
schema:
$ref: '#/definitions/Error'
403:
description: "Forbidden. User must have scope *ROLE_ADMIN*"
security:
- Bearer: []
/users/{userId}:
delete:
tags:
- "user"
summary: "Delete an user"
description: ""
operationId: "deleteUser"
produces:
- "application/json"
parameters:
- in: "path"
name: userId
type: string
required: true
responses:
204:
description: "User deleted"
400:
description: "Unable to delete user."
401:
description: "Unauthorized"
schema:
$ref: '#/definitions/Error'
403:
description: "Forbidden. User must have scope *ROLE_ADMIN*"
security:
- Bearer: []
securityDefinitions:
Bearer:
type: apiKey
name: Authorization
in: header
definitions:
VersionInformationFilter:
description: "VersionInformation filter for search."
type: object
properties:
projectName:
description: "Project which has created the artifact"
type: string
minLength: 1
maxLength: 100
example: "MyProject"
branch:
description: "Branch from which the artifact was created from (mostly develop or master)."
type: string
minLength: 1
maxLength: 255
example: "master"
artifact:
$ref: '#/definitions/Artifact'
dependencies:
description: "Shows Dependencies to other artifacts. Mostly this should be used for application dependencies."
type: array
items:
$ref: '#/definitions/Artifact'
latestVersion:
description: "If true, only the latest versions will be returned. *This flag can only be used while search filtering.*"
type: boolean
example: true
type:
description: "Defines the type of the package, for example. FRONTEND, BACKEND, JS-LIBRARY, BACKEND-LIBRARY"
type: string
example: "BACKEND"
maxLength: 255
uid:
description: "Unique UUID for identifying an entry"
example: "f95c4f24-9931-47b5-a4bd-6a74b4c46658"
maxLength: 55
Artifact:
description: "Contains information about an artifact in maven-style"
type: object
properties:
groupId:
description: "Artifact groupId"
type: string
minLength: 1
maxLength: 100
example: "com.project"
artifactId:
description: "Artifact artifactId"
type: string
minLength: 1
maxLength: 100
example: "MyLibrary"
version:
description: "Artifact version"
type: string
minLength: 1
maxLength: 20
example: "1.0.0"
VersionInformation:
description: "Contains information about the artifacts."
allOf:
- $ref: '#/definitions/VersionInformationFilter'
- type: object
required:
- projectName
- branch
- groupId
- artifactId
- version
- creationDate
- type
properties:
repositoryUrl:
description: "URL of the repository (optional)"
type: string
maxLength: 255
example: "https://github.com/Ragin-LundF/repomgr"
creationDate:
description: "Date when the artifact was created."
type: string
format: date-time
example: "2019-02-02T11:34:35.470+0000"
description:
description: "(optional) Description of the module. Can contain markdown syntax, which will be parsed to HTML."
type: string
example: '# RepoManager #
Dependencies and version management tool.
You can also use Markdown here.'
VersionInformationContainer:
description: "Response container object for VersionInformation lists"
type: object
properties:
versionInformation:
type: array
items:
$ref: '#/definitions/VersionInformation'
page:
$ref: '#/definitions/Page'
UserResponse:
description: "Response object for user requests, that contains the userId and the valid-state."
required:
- valid
- userId
type: object
properties:
valid:
description: "If true, the request was successful."
type: boolean
example: true
userId:
description: "User ID (UUID) to handle further requests against the user API."
type: string
maxLength: 100
example: "fa40f586-1588-4193-9ae0-d2ab2b316031"
User:
description: "Represents an user with credentials, role and project"
allOf:
- $ref: '#/definitions/Credentials'
- type: object
required:
- username
- password
- role
properties:
projectName:
description: "Describes the project to which the user is assigned"
type: "string"
maxLength: 100
example: "MyProject"
role:
description: "Role of the user. Use ROLE_ADMIN for working with the /user API and ROLE_USER to work with the /repository API."
type: "string"
enum:
- ROLE_ADMIN
- ROLE_USER
example: ROLE_USER
Credentials:
description: "Credentials object for username and password informations."
allOf:
- $ref: '#/definitions/Password'
- type: object
required:
- username
- password
properties:
username:
type: "string"
minLength: 1
maxLength: 100
example: "user001"
Password:
description: "Describes a password"
required:
- password
type: object
properties:
password:
type: "string"
maxLength: 255
example: "my-perfect-password"
Token:
description: "Represents the token as a result object to the client."
allOf:
- $ref: '#/definitions/Response'
- type: object
required:
- token
properties:
token:
description: "Represents the JWT token. This token must be set tot all requests against secured endpoints as a part of a Bearer token at the Authorization header."
type: "string"
maxLength: 255
example: "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInNjb3BlcyI6W3siYXV0aG9yaXR5IjoiUk9MRV9BRE1JTiJ9XSwiaXNzIjoiUmVwb01hbmFnZXIiLCJpYXQiOjE1NDkwNjE2MTgsImV4cCI6MTU0OTA2NTIyOX0.n0CK66KFTA81XDgGF89HzIDEfuvdwUOXm1put75QiZo"
userId:
description: "User ID of the current user"
type: string
example: "5c6a1223-076b-4bc0-b0b7-20b0da0e23fd"
Page:
description: "Page object for list results"
type: object
properties:
totalElements:
description: "Number of total elements"
type: integer
format: int64
example: 24
totalPages:
description: "Number of pages depending on current page size"
type: integer
example: 2
currentPage:
description: "Number of the current page"
type: integer
example: 2
numberOfElements:
description: "Number of elements of this page"
type: integer
example: 4
Message:
description: "Message object for returning defined error messages"
type: object
properties:
category:
description: "represents the priorisation of the message"
type: string
enum:
- ERROR
- WARN
- INFO
example: "INFO"
message:
description: "Message text for the client"
type: string
example: "Please read the API"
Response:
description: "Response container object with status."
type: object
properties:
_status:
description: "If true, then the request was successful."
type: boolean
example: true
_message:
$ref: '#/definitions/Message'
Error:
description: "Error messages"
type: object
properties:
timestamp:
type: string
format: date-time
description: "timestamp when error has occured"
example: "2019-02-02T11:34:35.470+0000"
status:
type: integer
description: "http error code"
example: 401
error:
type: string
description: "Error description"
example: "Unauthorized"
message:
type: string
description: "message from the backend"
example: "Unauthorized"
path:
type: string
description: "URI path where the error occured"
example: "/authentication/generate-token"