Skip to content

Commit b1855bd

Browse files
committed
chore(openapi): use dedicated operationIds wherever possible
1 parent f949cdc commit b1855bd

File tree

7 files changed

+38
-214
lines changed

7 files changed

+38
-214
lines changed

api/model-server-html.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ servers:
2020
paths:
2121
/:
2222
get:
23+
operationId: getIndex
2324
responses:
2425
"200":
2526
$ref: '#/components/responses/200'
2627
/content:
2728
get:
29+
operationId: getContent
2830
responses:
2931
"302":
3032
description: "Found <br> Redirect"
@@ -37,6 +39,7 @@ paths:
3739
value: "../repos/"
3840
/content/{versionHash}:
3941
get:
42+
operationId: getVersionHash
4043
parameters:
4144
- name: versionHash
4245
in: "path"
@@ -47,6 +50,7 @@ paths:
4750
"400":
4851
$ref: '#/components/responses/400'
4952
post:
53+
operationId: postVersionHash
5054
parameters:
5155
- name: versionHash
5256
in: "path"
@@ -66,6 +70,7 @@ paths:
6670
$ref: '#/components/responses/200'
6771
/content/{versionHash}/{nodeId}:
6872
get:
73+
operationId: getNodeIdForVersionHash
6974
parameters:
7075
- name: nodeId
7176
in: "path"
@@ -88,6 +93,7 @@ paths:
8893
$ref: "#/components/schemas/Function2"
8994
/repos:
9095
get:
96+
operationId: getRepos
9197
responses:
9298
"403":
9399
$ref: '#/components/responses/403'
@@ -97,6 +103,7 @@ paths:
97103
$ref: '#/components/responses/500'
98104
/history:
99105
get:
106+
operationId: getHistory
100107
responses:
101108
"302":
102109
description: "Found <br> Redirect"
@@ -109,6 +116,7 @@ paths:
109116
value: "../repos/"
110117
/history/{repoId}/{branch}:
111118
get:
119+
operationId: getRepoAndBranch
112120
parameters:
113121
- name: repoId
114122
in: "path"
@@ -144,6 +152,7 @@ paths:
144152
$ref: '#/components/responses/500'
145153
/history/{repoId}/{branch}/revert:
146154
post:
155+
operationId: revertBranch
147156
parameters:
148157
- name: repoId
149158
in: "path"

api/model-server.yaml

Lines changed: 11 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ paths:
3636
$ref: '#/components/responses/200'
3737
/headers:
3838
get:
39+
operationId: getHeaders
3940
responses:
4041
"200":
4142
$ref: '#/components/responses/200'
4243
/health:
4344
get:
45+
operationId: getHealth
4446
responses:
4547
"200":
4648
$ref: '#/components/responses/200'
@@ -93,6 +95,7 @@ paths:
9395
# schema:
9496
# $ref: "#/components/schemas/VersionDelta"
9597
post:
98+
operationId: postRepositoryBranch
9699
parameters:
97100
- name: repository
98101
in: "path"
@@ -142,6 +145,7 @@ paths:
142145
$ref: '#/components/responses/200'
143146
/v2/repositories/{repository}/branches/{branch}/listen:
144147
get:
148+
operationId: listenRepositoryBranch
145149
parameters:
146150
- name: lastKnown
147151
in: "query"
@@ -200,6 +204,7 @@ paths:
200204
type: string
201205
/v2/repositories/{repository}/branches/{branch}/poll:
202206
get:
207+
operationId: pollRepositoryBranch
203208
parameters:
204209
- name: lastKnown
205210
in: "query"
@@ -231,6 +236,7 @@ paths:
231236
type: object
232237
/v2/repositories/{repository}/branches/{branch}/pollHash:
233238
get:
239+
operationId: pollRepositoryBranchHash
234240
parameters:
235241
- name: lastKnown
236242
in: "query"
@@ -258,6 +264,7 @@ paths:
258264
$ref: '#/components/responses/200'
259265
/v2/repositories/{repository}/branches/{branch}/query:
260266
post:
267+
operationId: postRepositoryBranchQuery
261268
parameters:
262269
- name: repository
263270
in: "path"
@@ -331,7 +338,7 @@ paths:
331338
type: object
332339
/v2/repositories/{repository}/versions/{versionHash}/history/{oldestVersionHash}:
333340
get:
334-
description: "TODO"
341+
operationId: getOldestVersionHash
335342
responses:
336343
"200":
337344
$ref: '#/components/responses/200'
@@ -353,6 +360,7 @@ paths:
353360
type: string
354361
/v2/repositories/{repository}/versions/{versionHash}/query:
355362
post:
363+
operationId: postRepositoryVersionHashQuery
356364
parameters:
357365
- name: versionHash
358366
in: "path"
@@ -372,6 +380,7 @@ paths:
372380

373381
/v2/versions/{versionHash}:
374382
get:
383+
operationId: getVersionHash
375384
parameters:
376385
- name: lastKnown
377386
in: "query"
@@ -394,7 +403,7 @@ paths:
394403
type: object
395404
/v2/versions/{versionHash}/history/{oldestVersionHash}:
396405
get:
397-
description: "TODO"
406+
operationId: getOldestVersionHashForVersion
398407
responses:
399408
"200":
400409
$ref: '#/components/responses/200'
@@ -409,158 +418,6 @@ paths:
409418
required: true
410419
schema:
411420
type: string
412-
/json:
413-
get:
414-
responses:
415-
"200":
416-
$ref: '#/components/responses/200'
417-
/json/{repositoryId}:
418-
get:
419-
parameters:
420-
- name: repositoryId
421-
in: "path"
422-
required: true
423-
schema:
424-
type: string
425-
responses:
426-
"200":
427-
$ref: '#/components/responses/200json'
428-
/json/{repositoryId}/{versionHash}:
429-
get:
430-
parameters:
431-
- name: versionHash
432-
in: "path"
433-
required: true
434-
schema:
435-
type: string
436-
- name: repositoryId
437-
in: "path"
438-
required: true
439-
schema:
440-
type: string
441-
responses:
442-
"200":
443-
$ref: '#/components/responses/200json'
444-
/json/{repositoryId}/{versionHash}/poll:
445-
get:
446-
parameters:
447-
- name: repositoryId
448-
in: "path"
449-
required: true
450-
schema:
451-
type: string
452-
- name: versionHash
453-
in: "path"
454-
required: true
455-
schema:
456-
type: string
457-
responses:
458-
"200":
459-
$ref: '#/components/responses/200json'
460-
/json/{repositoryId}/{versionHash}/update:
461-
post:
462-
parameters:
463-
- name: repositoryId
464-
in: "path"
465-
required: true
466-
schema:
467-
type: string
468-
- name: versionHash
469-
in: "path"
470-
required: true
471-
schema:
472-
type: string
473-
responses:
474-
"404":
475-
description: "Not Found"
476-
content:
477-
'*/*':
478-
schema:
479-
type: string
480-
"403":
481-
$ref: '#/components/responses/403'
482-
"401":
483-
$ref: '#/components/responses/401'
484-
"500":
485-
$ref: '#/components/responses/500'
486-
"200":
487-
$ref: '#/components/responses/200json'
488-
/json/{repositoryId}/init:
489-
post:
490-
parameters:
491-
- name: repositoryId
492-
in: "path"
493-
required: true
494-
schema:
495-
type: string
496-
responses:
497-
"200":
498-
$ref: '#/components/responses/200json'
499-
/json/{repositoryId}/ws:
500-
get:
501-
parameters:
502-
- name: repositoryId
503-
in: "path"
504-
required: true
505-
schema:
506-
type: string
507-
- name: Connection
508-
in: "header"
509-
required: true
510-
description: "Websocket Connection parameter"
511-
schema:
512-
type: string
513-
- name: Upgrade
514-
in: "header"
515-
required: true
516-
description: "Websocket Upgrade parameter"
517-
schema:
518-
type: string
519-
- name: Sec-WebSocket-Key
520-
in: "header"
521-
required: true
522-
description: "Websocket Sec-WebSocket-Key parameter"
523-
schema:
524-
type: string
525-
responses:
526-
"403":
527-
$ref: '#/components/responses/403'
528-
"401":
529-
$ref: '#/components/responses/401'
530-
"500":
531-
$ref: '#/components/responses/500'
532-
"101":
533-
description: "Switching Protocols"
534-
headers:
535-
Connection:
536-
required: true
537-
schema:
538-
type: string
539-
Upgrade:
540-
required: true
541-
schema:
542-
type: string
543-
Sec-WebSocket-Accept:
544-
required: true
545-
schema:
546-
type: string
547-
/json/generate-ids:
548-
post:
549-
parameters:
550-
- name: quantity
551-
in: "query"
552-
required: false
553-
schema:
554-
type: integer
555-
responses:
556-
"403":
557-
$ref: '#/components/responses/403'
558-
"401":
559-
$ref: '#/components/responses/401'
560-
"500":
561-
$ref: '#/components/responses/500'
562-
"200":
563-
$ref: '#/components/responses/200json'
564421
/counter/{key}:
565422
post:
566423
parameters:
@@ -680,48 +537,6 @@ paths:
680537
$ref: '#/components/responses/200'
681538
"404":
682539
$ref: '#/components/responses/404'
683-
/json/v2/{repositoryId}/ws:
684-
get:
685-
parameters:
686-
- name: repositoryId
687-
in: "path"
688-
required: true
689-
schema:
690-
type: string
691-
- name: Connection
692-
in: "header"
693-
required: true
694-
description: "Websocket Connection parameter"
695-
schema:
696-
type: string
697-
- name: Upgrade
698-
in: "header"
699-
required: true
700-
description: "Websocket Upgrade parameter"
701-
schema:
702-
type: string
703-
- name: Sec-WebSocket-Key
704-
in: "header"
705-
required: true
706-
description: "Websocket Sec-WebSocket-Key parameter"
707-
schema:
708-
type: string
709-
responses:
710-
"101":
711-
description: "Switching Protocols"
712-
headers:
713-
Connection:
714-
required: true
715-
schema:
716-
type: string
717-
Upgrade:
718-
required: true
719-
schema:
720-
type: string
721-
Sec-WebSocket-Accept:
722-
required: true
723-
schema:
724-
type: string
725540
components:
726541
responses:
727542
"200":

model-server/src/main/kotlin/org/modelix/model/server/handlers/ContentExplorer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ class ContentExplorer(private val client: IModelClient, private val repoManager:
6565

6666
fun init(application: Application) {
6767
application.routing {
68-
get<Paths.contentGet> {
68+
get<Paths.getContent> {
6969
call.respondRedirect("../repos/")
7070
}
71-
get<Paths.contentVersionHashGet> {
71+
get<Paths.getVersionHash> {
7272
val versionHash = call.parameters["versionHash"]
7373
if (versionHash.isNullOrEmpty()) {
7474
call.respondText("version not found", status = HttpStatusCode.BadRequest)
@@ -87,7 +87,7 @@ class ContentExplorer(private val client: IModelClient, private val repoManager:
8787
bodyContent { contentPageBody(rootNode, versionHash, emptySet()) }
8888
}
8989
}
90-
post<Paths.contentVersionHashPost> {
90+
post<Paths.postVersionHash> {
9191
val versionHash = call.parameters["versionHash"]
9292
if (versionHash.isNullOrEmpty()) {
9393
call.respondText("version not found", status = HttpStatusCode.BadRequest)
@@ -111,7 +111,7 @@ class ContentExplorer(private val client: IModelClient, private val repoManager:
111111
},
112112
)
113113
}
114-
get<Paths.contentVersionHashNodeIdGet> {
114+
get<Paths.getNodeIdForVersionHash> {
115115
val id = call.parameters["nodeId"]!!.toLong()
116116
var found: PNodeAdapter? = null
117117
for (node in rootNodes) {

0 commit comments

Comments
 (0)