Skip to content

Commit 6ce3b0d

Browse files
committed
refactor(model-server): extract the V1 API into a separate spec
This makes room to adjust the base path of the v2 API to `/v2`. Due to the way authentication is handled, it is not straight-forward to implement the v1 API based on the generated classes. Splitting specs has also required adjustment to the SwaggerUI serving. The ktor plugin does not allow serving multiple specifications on the same route (despite genrally possible in the JS SwaggerUI). Therefore, we simply offer multiple routes for the different API versions.
1 parent 7ccfb5f commit 6ce3b0d

File tree

5 files changed

+272
-134
lines changed

5 files changed

+272
-134
lines changed
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
# WARNING - EXPERIMENTAL
2+
# This file was auto generated from the existing API using an IntelliJ plugin,
3+
# see https://www.jetbrains.com/help/idea/openapi.html#generate_openapi
4+
#
5+
# Manual changes were done for this 'spec' to work in-place with the
6+
# model-server for now. A lot of changes were done and are still necessary
7+
# to make this OpenAPI a viable artifact. It will most likely be split
8+
# into multiple OpenAPI files.
9+
10+
openapi: "3.0.3"
11+
info:
12+
title: "model-server public API"
13+
description: "modelix public API"
14+
version: "1.0.0"
15+
servers:
16+
- url: '/'
17+
description: model-server
18+
paths:
19+
/headers:
20+
get:
21+
operationId: getHeaders
22+
tags:
23+
- v1
24+
responses:
25+
"200":
26+
$ref: '#/components/responses/200'
27+
default:
28+
$ref: '#/components/responses/GeneralError'
29+
/counter/{key}:
30+
post:
31+
tags:
32+
- v1
33+
parameters:
34+
- name: key
35+
in: "path"
36+
required: true
37+
schema:
38+
type: string
39+
responses:
40+
"403":
41+
$ref: '#/components/responses/403'
42+
"401":
43+
$ref: '#/components/responses/401'
44+
"200":
45+
$ref: '#/components/responses/200'
46+
default:
47+
$ref: '#/components/responses/GeneralError'
48+
/get/{key}:
49+
get:
50+
tags:
51+
- v1
52+
parameters:
53+
- name: key
54+
in: "path"
55+
required: true
56+
schema:
57+
type: string
58+
responses:
59+
"403":
60+
$ref: '#/components/responses/403'
61+
"401":
62+
$ref: '#/components/responses/401'
63+
"404":
64+
$ref: '#/components/responses/404'
65+
"200":
66+
$ref: '#/components/responses/200'
67+
default:
68+
$ref: '#/components/responses/GeneralError'
69+
/getAll:
70+
put:
71+
tags:
72+
- v1
73+
responses:
74+
"403":
75+
$ref: '#/components/responses/403'
76+
"401":
77+
$ref: '#/components/responses/401'
78+
"200":
79+
$ref: '#/components/responses/200json'
80+
default:
81+
$ref: '#/components/responses/GeneralError'
82+
/getEmail:
83+
get:
84+
tags:
85+
- v1
86+
responses:
87+
"200":
88+
$ref: '#/components/responses/200'
89+
default:
90+
$ref: '#/components/responses/GeneralError'
91+
/getRecursively/{key}:
92+
get:
93+
tags:
94+
- v1
95+
parameters:
96+
- name: key
97+
in: "path"
98+
required: true
99+
schema:
100+
type: string
101+
responses:
102+
"200":
103+
$ref: '#/components/responses/200json'
104+
default:
105+
$ref: '#/components/responses/GeneralError'
106+
/poll/{key}:
107+
get:
108+
tags:
109+
- v1
110+
parameters:
111+
- name: key
112+
in: "path"
113+
required: true
114+
schema:
115+
type: string
116+
- name: lastKnownValue
117+
in: "query"
118+
required: false
119+
schema:
120+
type: string
121+
responses:
122+
"403":
123+
$ref: '#/components/responses/403'
124+
"401":
125+
$ref: '#/components/responses/401'
126+
"404":
127+
$ref: '#/components/responses/404'
128+
"200":
129+
$ref: '#/components/responses/200'
130+
default:
131+
$ref: '#/components/responses/GeneralError'
132+
/put/{key}:
133+
put:
134+
tags:
135+
- v1
136+
parameters:
137+
- name: key
138+
in: "path"
139+
required: true
140+
schema:
141+
type: string
142+
responses:
143+
"403":
144+
$ref: '#/components/responses/403'
145+
"401":
146+
$ref: '#/components/responses/401'
147+
"200":
148+
$ref: '#/components/responses/200'
149+
"404":
150+
$ref: '#/components/responses/404'
151+
default:
152+
$ref: '#/components/responses/GeneralError'
153+
/putAll:
154+
put:
155+
tags:
156+
- v1
157+
responses:
158+
"403":
159+
$ref: '#/components/responses/403'
160+
"401":
161+
$ref: '#/components/responses/401'
162+
"200":
163+
$ref: '#/components/responses/200'
164+
"404":
165+
$ref: '#/components/responses/404'
166+
default:
167+
$ref: '#/components/responses/GeneralError'
168+
components:
169+
responses:
170+
"200":
171+
description: OK
172+
content:
173+
text/plain:
174+
schema:
175+
type: string
176+
"200json":
177+
description: OK
178+
content:
179+
application/json:
180+
schema:
181+
type: string
182+
183+
"400":
184+
description: "Bad Request"
185+
content:
186+
application/problem+json:
187+
schema:
188+
$ref: '#/components/schemas/Problem'
189+
"401":
190+
description: "Unauthorized"
191+
content:
192+
application/problem+json:
193+
schema:
194+
$ref: '#/components/schemas/Problem'
195+
"403":
196+
description: "Forbidden"
197+
content:
198+
application/problem+json:
199+
schema:
200+
$ref: '#/components/schemas/Problem'
201+
"404":
202+
description: "Not Found"
203+
content:
204+
application/problem+json:
205+
schema:
206+
$ref: '#/components/schemas/Problem'
207+
GeneralError:
208+
description: Unexpected error
209+
content:
210+
application/problem+json:
211+
schema:
212+
$ref: '#/components/schemas/Problem'
213+
214+
schemas:
215+
# From https://opensource.zalando.com/restful-api-guidelines/models/problem-1.0.1.yaml
216+
Problem:
217+
type: object
218+
properties:
219+
type:
220+
type: string
221+
format: uri-reference
222+
description: >
223+
A URI reference that uniquely identifies the problem type only in the
224+
context of the provided API. Opposed to the specification in RFC-9457,
225+
it is neither recommended to be dereferenceable and point to a
226+
human-readable documentation nor globally unique for the problem type.
227+
default: 'about:blank'
228+
example: '/some/uri-reference'
229+
title:
230+
type: string
231+
description: >
232+
A short summary of the problem type. Written in English and readable
233+
for engineers, usually not suited for non technical stakeholders and
234+
not localized.
235+
example: some title for the error situation
236+
status:
237+
type: integer
238+
format: int32
239+
description: >
240+
The HTTP status code generated by the origin server for this occurrence
241+
of the problem.
242+
minimum: 100
243+
maximum: 600
244+
exclusiveMaximum: true
245+
detail:
246+
type: string
247+
description: >
248+
A human readable explanation specific to this occurrence of the
249+
problem that is helpful to locate the problem and give advice on how
250+
to proceed. Written in English and readable for engineers, usually not
251+
suited for non technical stakeholders and not localized.
252+
example: some description for the error situation
253+
instance:
254+
type: string
255+
format: uri-reference
256+
description: >
257+
A URI reference that identifies the specific occurrence of the problem,
258+
e.g. by adding a fragment identifier or sub-path to the problem type.
259+
May be used to locate the root of this problem in the source code.
260+
example: '/some/uri-reference#specific-occurrence-context'

0 commit comments

Comments
 (0)