source: TFP-WebServer/MarkersMod/src/Markers.openapi.yaml@ 460

Last change on this file since 460 was 460, checked in by alloc, 15 months ago

More OpenAPI specs added
OpenAPI specs cleanup to have everything validate fine
Added CORS support to API endpoints

File size: 6.0 KB
Line 
1openapi: 3.1.0
2info:
3 title: Markers
4 version: '1'
5
6components:
7 schemas:
8 MarkerId:
9 type: string
10 format: uuid
11 description: Unique identifier of the marker
12
13 MarkersElement:
14 type: object
15 properties:
16 id:
17 $ref: '#/components/schemas/MarkerId'
18 x:
19 type: integer
20 examples:
21 - -57
22 y:
23 type: integer
24 examples:
25 - 321
26 icon:
27 type:
28 - string
29 - 'null'
30 format: uri
31 examples:
32 - https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Blue_question_mark_icon.svg/1200px-Blue_question_mark_icon.svg.png
33 description: Icon used for the marker
34 required:
35 - id
36 - x
37 - y
38
39 MarkersList:
40 type: array
41 items:
42 $ref: '#/components/schemas/MarkersElement'
43
44
45 requestBodies:
46 MarkersBodyIn:
47 content:
48 application/json:
49 schema:
50 type: object
51 properties:
52 x:
53 type: integer
54 examples:
55 - -43
56 y:
57 type: integer
58 examples:
59 - 842
60 icon:
61 type: string
62 format: uuid
63 examples:
64 - https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Blue_question_mark_icon.svg/1200px-Blue_question_mark_icon.svg.png
65 required:
66 - x
67 - y
68 required: true
69
70
71 responses:
72 MarkersBodyOut:
73 description: Found marker
74 content:
75 application/json:
76 schema:
77 type: object
78 properties:
79 data:
80 $ref: '#/components/schemas/MarkersList'
81 meta:
82 $ref: './openapi.yaml#/components/schemas/ResultEnvelopeMeta'
83 required:
84 - data
85 - meta
86
87 MarkersIdOut:
88 description: Created marker's ID
89 content:
90 application/json:
91 schema:
92 type: object
93 properties:
94 data:
95 type: string
96 format: uuid
97 meta:
98 $ref: './openapi.yaml#/components/schemas/ResultEnvelopeMeta'
99 required:
100 - data
101 - meta
102
103
104 parameters:
105 MarkerIdParameter:
106 name: id
107 in: path
108 required: true
109 schema:
110 type: string
111 format: uuid
112 description: ID of marker to fetch
113
114
115paths:
116 /api/markers:
117 get:
118 tags:
119 - Map
120 summary: Markers list
121 description: Fetch a list of all defined map markers
122 operationId: markers.get
123 responses:
124 200:
125 description: List of found markers
126 $ref: '#/components/responses/MarkersBodyOut'
127
128 post:
129 tags:
130 - Map
131 summary: Marker create
132 description: Create a new map marker
133 operationId: markers.post
134 requestBody:
135 $ref: '#/components/requestBodies/MarkersBodyIn'
136 responses:
137 201:
138 description: Marker with updated values
139 $ref: '#/components/responses/MarkersIdOut'
140 400:
141 description: >-
142 Invalid request body, errorCode will be one of 'NO_OR_INVALID_X',
143 'NO_OR_INVALID_Y'
144 $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
145 403:
146 $ref: './openapi.yaml#/components/responses/Unauthorized'
147 security:
148 - apiTokenName: []
149 apiTokenSecret: []
150 - sessionCookie: []
151
152 /api/markers/{id}:
153 get:
154 tags:
155 - Map
156 summary: Marker show
157 description: Fetch a single defined map marker
158 operationId: markers.get.id
159 parameters:
160 - $ref: '#/components/parameters/MarkerIdParameter'
161 responses:
162 200:
163 description: Single found marker
164 $ref: '#/components/responses/MarkersBodyOut'
165 404:
166 description: Marker ID not found, errorCode will be 'ID_NOT_FOUND'
167 $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
168
169 put:
170 tags:
171 - Map
172 summary: Marker update
173 description: Update a single defined map marker
174 operationId: markers.put.id
175 parameters:
176 - $ref: '#/components/parameters/MarkerIdParameter'
177 requestBody:
178 $ref: '#/components/requestBodies/MarkersBodyIn'
179 responses:
180 200:
181 description: Marker with updated values
182 $ref: '#/components/responses/MarkersBodyOut'
183 400:
184 description: >-
185 Invalid request body, errorCode will be one of 'NO_OR_INVALID_X',
186 'NO_OR_INVALID_Y'
187 $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
188 404:
189 description: Marker ID not found, errorCode will be 'ID_NOT_FOUND'
190 $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
191 403:
192 $ref: './openapi.yaml#/components/responses/Unauthorized'
193 security:
194 - apiTokenName: []
195 apiTokenSecret: []
196 - sessionCookie: []
197
198 delete:
199 tags:
200 - Map
201 summary: Marker delete
202 description: Delete a single defined map marker
203 operationId: markers.delete.id
204 parameters:
205 - $ref: '#/components/parameters/MarkerIdParameter'
206 responses:
207 204:
208 description: Deleted marker
209 $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
210 404:
211 description: Marker ID not found
212 $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
213 403:
214 $ref: './openapi.yaml#/components/responses/Unauthorized'
215 security:
216 - apiTokenName: []
217 apiTokenSecret: []
218 - sessionCookie: []
Note: See TracBrowser for help on using the repository browser.