source: apis/deviceservice.yaml@ 8f1d0b7

debian/bullseye
Last change on this file since 8f1d0b7 was 9f0f35e, checked in by Joachim Langenbach <joachim.langenbach@…>, 7 years ago
  • Switched from CamelCase to camel_case naming
    • Added mapservice-webclient to configure script (Closes #33)
    • Switched from unittest to pytest tests
    • Fixed testing errors with post datas by introducing x-fail vendor extension
    • Added x-vendor extension to mark a dependency on mapservice for an operation and the controller_test.mustache adds needed fixtures
    • Copying conftest.py from *_impl/tests into */test (it's a workaround to get the flask app fixtures)
    • Fixed controller_test.mustache, to test the first response with set status code
  • Property mode set to 100644
File size: 19.2 KB
Line 
1openapi: 3.0.0
2info:
3 title: GNUBoat Device API
4 contact:
5 name: EngSaS - Engineering Solutions and Services Langenbach
6 url: 'http://www.engsas.com'
7 email: info@engsas.de
8 license:
9 name: GPL 3
10 url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'
11 version: v1
12 description: API for GNUBoat devices
13servers:
14 - url: 'http://gnuboat/deviceservice/{version}'
15 description: The production API server
16 variables:
17 version:
18 default: v1
19 - url: 'http://localhost:8090/deviceservice/{version}'
20 description: The local flask development url
21 variables:
22 version:
23 default: v1
24paths:
25 '/instrumentdata':
26 get:
27 description: The current dates like speed, water depth, ...
28 tags:
29 - device
30 operationId: instrumentDataGet
31 responses:
32 '200':
33 description: OK
34 content:
35 application/json:
36 schema:
37 $ref: '#/components/schemas/InstrumentData'
38 '404':
39 description: Returned, if there is no current, valid dataset
40 $ref: '#/components/responses/NotFound'
41 '500':
42 $ref: '#/components/responses/InternalServerError'
43 '/track':
44 get:
45 description: The track with dates like speed, water depth, ...
46 tags:
47 - device
48 operationId: trackGet
49 responses:
50 '200':
51 description: OK
52 content:
53 application/json:
54 schema:
55 $ref: '#/components/schemas/Track'
56 '500':
57 $ref: '#/components/responses/InternalServerError'
58 '/shutdown':
59 get:
60 description: Shutdown the device
61 tags:
62 - device
63 operationId: shutdown
64 responses:
65 '204':
66 description: Shutdown initiated
67 '500':
68 $ref: '#/components/responses/InternalServerError'
69 '/logfiles':
70 get:
71 description: List of local logfiles
72 tags:
73 - deviceLogs
74 operationId: logfilesGet
75 responses:
76 '200':
77 description: OK
78 content:
79 application/json:
80 schema:
81 $ref: '#/components/schemas/Logfiles'
82 '500':
83 $ref: '#/components/responses/InternalServerError'
84 '/logfiles/{name}':
85 get:
86 description: Download local logfiles
87 tags:
88 - deviceLogs
89 operationId: logsGet
90 parameters:
91 - name: name
92 in: path
93 description: Logfiles to download
94 required: true
95 schema:
96 type: string
97 style: simple
98 explode: true
99 example: 'test-1.log,test-2.log'
100 responses:
101 '200':
102 description: OK
103 content:
104 text/plain:
105 schema:
106 type: string
107 application/zip:
108 schema:
109 type: string
110 format: byte
111 '404':
112 $ref: '#/components/responses/NotFound'
113 '500':
114 $ref: '#/components/responses/InternalServerError'
115 '/logfiles/{name}/track':
116 get:
117 description: Get the logfile as a track
118 tags:
119 - deviceLogs
120 operationId: logsTrackGet
121 parameters:
122 - name: name
123 in: path
124 description: Logfiles to download
125 required: true
126 schema:
127 type: string
128 example: 'test-1.log'
129 responses:
130 '200':
131 description: OK
132 content:
133 application/json:
134 schema:
135 $ref: '#/components/schemas/Track'
136 '404':
137 $ref: '#/components/responses/NotFound'
138 '500':
139 $ref: '#/components/responses/InternalServerError'
140 '/maps':
141 get:
142 description: Get a list of currently installed maps
143 tags:
144 - deviceMaps
145 operationId: mapsGet
146 responses:
147 '200':
148 description: OK
149 content:
150 application/json:
151 schema:
152 $ref: '#/components/schemas/Maps'
153 '500':
154 $ref: '#/components/responses/InternalServerError'
155 post:
156 description: Upload a new mbtiles file as a new map
157 tags:
158 - deviceMaps
159 operationId: mapsUpload
160 requestBody:
161 required: true
162 content:
163 application/octet-stream:
164 schema:
165 type: string
166 format: byte
167 responses:
168 '201':
169 description: OK
170 content:
171 application/json:
172 schema:
173 $ref: '#/components/schemas/Maps'
174 '400':
175 $ref: '#/components/responses/BadRequest'
176 '413':
177 $ref: '#/components/responses/PayloadToLarge'
178 '500':
179 $ref: '#/components/responses/InternalServerError'
180 '/maps/{mapname}/{zoom}/{x_tile}/{y_tile}.png':
181 get:
182 description: Get tiles of a map with help of it's tiles urls
183 tags:
184 - deviceMaps
185 operationId: mapsTileGet
186 x-xfail-test:
187 reason: 'URL Ending with {{y_tile}}.png is not resolved correctly by openapi-generator'
188 parameters:
189 - name: mapname
190 in: path
191 description: Map basename
192 required: true
193 schema:
194 type: string
195 example: '7f92508911d84ff957acc862fd38bdafddbaae14ce508dda2aa6857e73863318'
196 - name: zoom
197 in: path
198 description: Zoomlevel
199 required: true
200 schema:
201 type: integer
202 example: 15
203 - name: x_tile
204 in: path
205 description: Number of the tile in x dimension
206 required: true
207 schema:
208 type: integer
209 example: 17298
210 - name: y_tile
211 in: path
212 description: Number of the tile in y dimension
213 required: true
214 schema:
215 type: integer
216 example: 21435
217 responses:
218 '200':
219 description: OK
220 content:
221 image/*:
222 schema:
223 type: string
224 format: binary
225 #contentEncoding: base64
226 #contentMediaType: image/png
227 '400':
228 $ref: '#/components/responses/BadRequest'
229 '404':
230 $ref: '#/components/responses/NotFound'
231 '500':
232 $ref: '#/components/responses/InternalServerError'
233 '/mapservice':
234 get:
235 description: The status of the mapservice connection
236 tags:
237 - mapservice
238 operationId: mapserviceStatus
239 x-mapservice-required: True
240 responses:
241 '200':
242 description: OK
243 content:
244 application/json:
245 schema:
246 $ref: '#/components/schemas/MapserviceStatus'
247 '500':
248 $ref: '#/components/responses/InternalServerError'
249 '502':
250 $ref: '#/components/responses/BadGatewayError'
251 '504':
252 description: Mapservice has not answered and connection timed out
253 content:
254 application/json:
255 schema:
256 $ref: '#/components/schemas/MapserviceStatus'
257 '/mapservice/waters':
258 get:
259 description: Search waters on mapservice
260 tags:
261 - mapservice
262 summary: Find own waters
263 operationId: watersGet
264 x-mapservice-required: True
265 parameters:
266 - name: name
267 in: query
268 schema:
269 $ref: '#/components/schemas/itemName'
270 example: Miss
271 - $ref: '#/components/parameters/orderBy'
272 - $ref: '#/components/parameters/offset'
273 - $ref: '#/components/parameters/limit'
274 responses:
275 '200':
276 description: OK
277 content:
278 application/json:
279 schema:
280 $ref: '#/components/schemas/Waters'
281 '400':
282 $ref: '#/components/responses/BadRequest'
283 '401':
284 $ref: '#/components/responses/Unauthorized'
285 '404':
286 $ref: '#/components/responses/NotFound'
287 '500':
288 $ref: '#/components/responses/InternalServerError'
289 '502':
290 $ref: '#/components/responses/BadGatewayError'
291 '504':
292 description: Mapservice has not answered and connection timed out
293 content:
294 application/json:
295 schema:
296 $ref: '#/components/schemas/MapserviceStatus'
297 '/mapservice/log':
298 post:
299 description: Upload log to the mapservice
300 tags:
301 - mapservice
302 summary: Add a new log
303 operationId: logCreate
304 x-mapservice-required: True
305 x-xfail-test:
306 reason: 'Timesout because of not running celery broker during the tests'
307 requestBody:
308 content:
309 application/json:
310 schema:
311 $ref: '#/components/schemas/LogCreation'
312 responses:
313 '204':
314 description: Log created
315 '400':
316 $ref: '#/components/responses/BadRequest'
317 '401':
318 $ref: '#/components/responses/Unauthorized'
319 '404':
320 $ref: '#/components/responses/NotFound'
321 '502':
322 $ref: '#/components/responses/BadGatewayError'
323 '500':
324 $ref: '#/components/responses/InternalServerError'
325components:
326 schemas:
327 point:
328 title: 'Point of type [longitude, latitude] in decimal degrees'
329 type: array
330 maxItems: 2
331 minItems: 2
332 items:
333 type: number
334 speedOverGround:
335 title: Speed over Ground in m/s
336 type: number
337 format: float
338 speedThroughWater:
339 title: Speed through the water in m/s
340 type: number
341 format: float
342 courseOverGround:
343 title: Course over the ground in degree
344 type: number
345 format: float
346 minimum: 0
347 maximum: 360
348 waterDepth:
349 title: Water depth in m
350 type: number
351 format: float
352 waterTemperature:
353 title: Water temperature in degree celsius
354 type: number
355 format: float
356 gpsFix:
357 title: Status of GPS fix
358 type: string
359 enum:
360 - '-'
361 - '2D'
362 - '3D'
363 InstrumentData:
364 title: Data displayed in the instrument section
365 type: object
366 properties:
367 speedThroughWater:
368 $ref: '#/components/schemas/speedThroughWater'
369 speedOverGround:
370 $ref: '#/components/schemas/speedOverGround'
371 courseOverGround:
372 $ref: '#/components/schemas/courseOverGround'
373 waterDepth:
374 $ref: '#/components/schemas/waterDepth'
375 waterTemperature:
376 $ref: '#/components/schemas/waterTemperature'
377 position:
378 $ref: '#/components/schemas/point'
379 gpsFix:
380 $ref: '#/components/schemas/gpsFix'
381 required:
382 - speedOverGround
383 - courseOverGround
384 - waterDepth
385 - position
386 - gpsFix
387 Track:
388 title: List of InstrumentData sorted by time
389 type: object
390 additionalProperties:
391 type: object
392 properties:
393 code:
394 type: integer
395 format: int64
396 text:
397 $ref: '#/components/schemas/InstrumentData'
398 Logfile:
399 title: A logfile
400 type: string
401 Logfiles:
402 title: Array of logfiles
403 type: array
404 items:
405 $ref: '#/components/schemas/Logfile'
406 map:
407 title: Represents a Map
408 description: Following the tilejson specification https://github.com/mapbox Version 2.0.0
409 type: object
410 properties:
411 tilejson:
412 description: Version number of the tilejson spec (semver.org style)
413 type: string
414 name:
415 description: Name describing the tileset
416 type: string
417 description:
418 type: string
419 version:
420 description: semver.org style version number of the map
421 type: string
422 attribution:
423 description: Attribution label of the map (could be interprated as HTML or literal text)
424 type: string
425 template:
426 description: Mustache tamplate for format data from grids
427 type: string
428 legend:
429 description: Legend to be displayed (could be treated as HTML or literal text)
430 type: string
431 schema:
432 description: The map tile scheme (xyz or tms). If missing xyz
433 type: string
434 enum:
435 - 'xyz'
436 - 'tms'
437 default: 'xyz'
438 tiles:
439 description: Url to get the tiles from. It must be at least one endpoint. If more than one endpoints given, all must return the same information for the same url. {z}, {y}, {x} should be replaced by zoomleve, y tile number and x tile number.
440 type: array
441 items:
442 type: string
443 minItems: 1
444 grids:
445 description: An array of interactivity endpoints
446 type: array
447 items:
448 type: string
449 data:
450 description: An array of data files in GeoJSON format
451 type: array
452 items:
453 type: string
454 minzoom:
455 type: integer
456 minimum: 0
457 maximum: 30
458 default: 0
459 maxzoom:
460 type: integer
461 minimum: 0
462 maximum: 30
463 default: 30
464 bounds:
465 description: The maximum extent of available map tiles at any zoomlevel, in WGS84 reference system. The bounds are given in the order left, bottom, right, top
466 type: array
467 items:
468 type: number
469 format: float
470 minItems: 4
471 maxItems: 4
472 center:
473 description: Initial values of longitude, latitude and zoomlevel
474 type: array
475 items:
476 type: number
477 format: float
478 minItems: 3
479 maxItems: 3
480 required:
481 - tilejson
482 - tiles
483 Maps:
484 title: List of Map
485 type: array
486 items:
487 $ref: '#/components/schemas/map'
488 MapserviceStatus:
489 type: string
490 enum:
491 - 'NO_API_KEY'
492 - 'NO_DEVICE'
493 - 'DEVICE_NOT_FOUND'
494 - 'NO_CONNECTION'
495 - 'OK'
496 itemName:
497 title: Item Name
498 type: string
499 itemId:
500 title: Item ID
501 type: integer
502 format: int64
503 comment:
504 title: Comment of an item
505 type: string
506 order:
507 title: order
508 enum:
509 - desc
510 - asc
511 type: string
512 default: asc
513 description: |
514 Sort order:
515 * `asc` - Ascending, from A to Z
516 * `desc` - Descending, from Z to A
517 example: asc
518 Water:
519 title: Water
520 type: object
521 properties:
522 waterId:
523 $ref: '#/components/schemas/itemId'
524 name:
525 $ref: '#/components/schemas/itemName'
526 gauges:
527 $ref: '#/components/schemas/Gauges'
528 required:
529 - waterId
530 - name
531 Waters:
532 title: A list of Water
533 type: array
534 items:
535 $ref: '#/components/schemas/Water'
536 ReferenceWaterLevelGaugeHeight:
537 title: Gauge Height of reference water level of a Gauge
538 description: The gauge height (stage) for reference water level. The reference water level is the water level, the depth on the map is shown at. Therefore, the water depth of a LogEntry is transformed to this referenceWaterLevel, with help of the gaugeHeight of the Log related to the LogEntry.
539 type: number
540 format: float
541 GaugeHeight:
542 title: 'Gauge height (stage) of the gauge, at the time of measuring'
543 type: number
544 format: float
545 Gauge:
546 title: Gauge
547 type: object
548 properties:
549 gaugeId:
550 $ref: '#/components/schemas/itemId'
551 name:
552 $ref: '#/components/schemas/itemName'
553 location:
554 $ref: '#/components/schemas/point'
555 referenceWaterLevelGaugeHeight:
556 $ref: '#/components/schemas/ReferenceWaterLevelGaugeHeight'
557 comment:
558 $ref: '#/components/schemas/comment'
559 required:
560 - gaugeId
561 - name
562 - location
563 - referenceWaterLevelGaugeHeight
564 Gauges:
565 title: Gauges
566 type: array
567 items:
568 $ref: '#/components/schemas/Gauge'
569 LogCreation:
570 title: Log for Creation
571 type: object
572 properties:
573 water:
574 $ref: '#/components/schemas/itemId'
575 gauge:
576 $ref: '#/components/schemas/itemId'
577 gaugeHeight:
578 $ref: '#/components/schemas/GaugeHeight'
579 comment:
580 $ref: '#/components/schemas/comment'
581 logfile:
582 $ref: '#/components/schemas/Logfile'
583 delete:
584 description: Delete the logfile locally after successfull upload
585 type: boolean
586 default: True
587 required:
588 - water
589 - gauge
590 - gaugeHeight
591 - logfile
592 example:
593 water: 1
594 gauge: 1
595 gaugeHeight: 66
596 logfile: test-1.log
597 comment: 'LogCreation for auto generated tests'
598 HttpError:
599 title: HTTP Error Response Object
600 type: object
601 properties:
602 type:
603 type: string
604 title:
605 type: string
606 detail:
607 type: string
608 instance:
609 type: string
610 required:
611 - type
612 - title
613 - detail
614 - instance
615 responses:
616 BadRequest:
617 description: Bad Request (400)
618 content:
619 application/problem+json:
620 schema:
621 $ref: '#/components/schemas/HttpError'
622 Unauthorized:
623 description: Unauthorized (401) acces to resource
624 content:
625 application/problem+json:
626 schema:
627 $ref: '#/components/schemas/HttpError'
628 NotFound:
629 description: Item with given Id not found
630 content:
631 application/problem+json:
632 schema:
633 $ref: '#/components/schemas/HttpError'
634 PayloadToLarge:
635 description: Uploaded file is to large (413)
636 content:
637 application/problem+json:
638 schema:
639 $ref: '#/components/schemas/HttpError'
640 InternalServerError:
641 description: Internal Server Error (HTTP Code 500)
642 content:
643 application/problem+json:
644 schema:
645 $ref: '#/components/schemas/HttpError'
646 BadGatewayError:
647 description: Bad Gateway (HTTP Code 502)
648 content:
649 application/problem+json:
650 schema:
651 $ref: '#/components/schemas/HttpError'
652 parameters:
653 orderBy:
654 name: order_by
655 in: query
656 description: 'Order by field: name'
657 schema:
658 type: string
659 default: name
660 example: name
661 order:
662 name: order
663 in: query
664 description: Order
665 schema:
666 $ref: '#/components/schemas/order'
667 example: ''
668 offset:
669 name: offset
670 in: query
671 description: >-
672 Skip over a number of elements by specifying an offset value for the
673 query
674 schema:
675 type: integer
676 format: int32
677 default: 0
678 example: 0
679 limit:
680 name: limit
681 in: query
682 description: Limit the number of elements on the response
683 style: form
684 explode: true
685 schema:
686 type: integer
687 format: int32
688 default: 10
689 example: 10
690tags:
691 - name: device
692 description: All actions related to the device functionality
693 - name: deviceLogs
694 description: All actions for handling logs on the local device
695 - name: deviceMaps
696 description: All actions for handlings maps on the local device
697 - name: mapservice
698 description: All actions used to interact with a GNUBoat mapservice
Note: See TracBrowser for help on using the repository browser.