Index: apis/mapservice.yaml
===================================================================
--- apis/mapservice.yaml	(revision dae7d73e225ed8d97f577744bac5b6f68e4f0af9)
+++ apis/mapservice.yaml	(revision dae7d73e225ed8d97f577744bac5b6f68e4f0af9)
@@ -0,0 +1,1523 @@
+openapi: 3.0.0
+info:
+  title: GNUBoat Mapservice API
+  contact:
+    name: EngSaS - Engineering Solutions and Services Langenbach
+    url: 'http://www.engsas.com'
+    email: info@engsas.de
+  license:
+    name: GPL 3
+    url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'
+  version: v1
+  description: API to upload log files with water depth to GNUBoat server
+servers:
+  - url: 'https://gnuboat.engsas.com/mapservice/{version}'
+    description: The production API server
+    variables:
+      version:
+        default: v1
+  - url: 'http://localhost:8080/mapservice/{version}'
+    description: The local flask development url
+    variables:
+      version:
+        default: v1
+paths:
+  /user:
+    get:
+      description: Returns information of current/authorized user
+      tags:
+        - users
+      summary: Returns info of a user
+      operationId: usersGet
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/User'
+              examples:
+                User:
+                  $ref: '#/components/examples/User'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+    post:
+      description: Registers a new user
+      tags:
+        - users
+      summary: Registers a new user
+      operationId: usersRegister
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UserCreation'
+            examples:
+              UserCreation:
+                $ref: '#/components/examples/UserCreation'
+      responses:
+        '201':
+          description: Userr created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/User'
+              examples:
+                User:
+                  $ref: '#/components/examples/User'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+    options:
+      description: Used by CORS preflight
+      tags:
+        - users
+      responses:
+        '200':
+          description: CORS prefilght requests should return 200 as status code
+          content:
+            application/json: {}
+  /user/apikey_create:
+    get:
+      description: Generates and returns a new API key for current user
+      tags:
+        - users
+      summary: Returns a new API key
+      operationId: usersApiKeyCreate
+      security:
+        - basicAuth: []
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/apiKeys'
+              example: NewApiKey4711
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+  '/user/{api_key}':
+    delete:
+      description: Deletes given API key and returns remaining API keys of the user
+      tags:
+        - users
+      summary: Deletes API key
+      operationId: usersApiKeyDelete
+      security:
+        - basicAuth: []
+      parameters:
+        - name: api_key
+          in: path
+          description: API key
+          required: true
+          schema:
+            $ref: '#/components/schemas/apiKey'
+          example: test_key_delete
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/apiKeys'
+              example: ApiKey4711
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '404':
+          $ref: '#/components/responses/NotFound'
+  '/user/activate/{activation_code}':
+    get:
+      description: Activates a user account
+      tags:
+        - users
+      summary: Activates a user account
+      operationId: usersActivate
+      parameters:
+        - name: activation_code
+          in: path
+          description: Activation code
+          required: true
+          schema:
+            $ref: '#/components/schemas/activationCode'
+          example: dac9630aec642a428cd73f4be0a03569
+      responses:
+        '302':
+          description: OK or not OK
+          headers:
+            Location:
+              schema:
+                type: string
+              description: 'URL to the website, showing the result of the activation'
+  /waters:
+    get:
+      description: Returns all waters
+      tags:
+        - waters
+      summary: Find waters
+      operationId: watersGet
+      parameters:
+        - name: name
+          in: query
+          schema:
+            $ref: '#/components/schemas/itemName'
+          example: Test
+        - name: manager
+          in: query
+          schema:
+            $ref: '#/components/schemas/username'
+          example: autotests
+        - name: stakeholder
+          in: query
+          description: A stakeholder is a user, which has uploaded Logfiles to water, added a gauge, ...
+          schema:
+            $ref: '#/components/schemas/username'
+          example: autotests
+        - $ref: '#/components/parameters/orderBy'
+        - $ref: '#/components/parameters/offset'
+        - $ref: '#/components/parameters/limit'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/waters'
+              examples:
+                Waters:
+                  $ref: '#/components/examples/waters'
+        '404':
+          $ref: '#/components/responses/NotFound'
+    post:
+      description: Adds a new water to the database
+      tags:
+        - waters
+      summary: Add a new water
+      operationId: watersCreate
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/WaterCreation'
+      responses:
+        '201':
+          description: Water created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Water'
+              examples:
+                Water:
+                  $ref: '#/components/examples/Water'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+  '/waters/{id}':
+    get:
+      description: Returns the water identified by id
+      tags:
+        - waters
+      summary: Represents a water
+      operationId: watersGetById
+      parameters:
+        - name: id
+          in: path
+          description: Item ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Water'
+              examples:
+                Water:
+                  $ref: '#/components/examples/Water'
+        '404':
+          $ref: '#/components/responses/NotFound'
+  '/waters/{water_id}/gauges':
+    get:
+      description: Returns all gauges of water waterId
+      tags:
+        - waters
+      summary: Find gauges of water waterId by gaugeId
+      operationId: watersGaugesGet
+      parameters:
+        - name: water_id
+          in: path
+          description: Water ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+        - name: name
+          in: query
+          schema:
+            $ref: '#/components/schemas/itemName'
+          example: Test
+        - name: manager
+          in: query
+          schema:
+            $ref: '#/components/schemas/username'
+          example: autotests
+        - $ref: '#/components/parameters/orderBy'
+        - $ref: '#/components/parameters/offset'
+        - $ref: '#/components/parameters/limit'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Gauges'
+              examples:
+                Gauges:
+                  $ref: '#/components/examples/Gauges'
+            application/geo+json:
+              schema:
+                $ref: '#/components/schemas/GaugesGeoJson'
+              examples:
+                Gauge:
+                  $ref: '#/components/examples/GaugesGeoJson'
+    post:
+      description: Adds a new gauge for water waterId to the database
+      tags:
+        - waters
+      summary: Add a new water
+      operationId: watersGaugeCreate
+      parameters:
+        - name: water_id
+          in: path
+          description: Water ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/GaugeCreation'
+            example:
+              name: New Orleans
+              location:
+                - 90.136111
+                - 29.934722
+              referenceWaterLevelGaugeHeight: 5.1
+      responses:
+        '201':
+          description: Gauge created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Gauge'
+              examples:
+                Gauge:
+                  $ref: '#/components/examples/Gauge'
+            application/geo+json:
+              schema:
+                $ref: '#/components/schemas/GaugeGeoJson'
+              examples:
+                Gauge:
+                  $ref: '#/components/examples/GaugeGeoJson'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+  '/waters/{water_id}/gauges/{gauge_id}':
+    get:
+      description: Returns the gauge identified by id
+      tags:
+        - waters
+      summary: Represents a gauge
+      operationId: watersGaugeGetById
+      parameters:
+        - name: water_id
+          in: path
+          description: Water ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+        - name: gauge_id
+          in: path
+          description: Gauge ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Gauge'
+              examples:
+                Gauge:
+                  $ref: '#/components/examples/Gauge'
+            application/geo+json:
+              schema:
+                $ref: '#/components/schemas/GaugeGeoJson'
+              examples:
+                Gauge:
+                  $ref: '#/components/examples/GaugeGeoJson'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '404':
+          $ref: '#/components/responses/NotFound'
+  /devices:
+    get:
+      description: Returns all devices of user
+      tags:
+        - devices
+      summary: Find devices by id
+      operationId: devicesGet
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: name
+          in: query
+          schema:
+            $ref: '#/components/schemas/itemName'
+          example: Gnu
+        - $ref: '#/components/parameters/orderBy'
+        - $ref: '#/components/parameters/offset'
+        - $ref: '#/components/parameters/limit'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/devices'
+              examples:
+                Devices:
+                  $ref: '#/components/examples/devices'
+        '404':
+          $ref: '#/components/responses/NotFound'
+    post:
+      description: Adds a new device to the database
+      tags:
+        - devices
+      summary: Add a new device
+      operationId: devicesCreate
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/DeviceCreation'
+            example:
+              name: Lovely Boat
+              sensorDepth: 2
+      responses:
+        '201':
+          description: Device created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Device'
+              examples:
+                Device:
+                  $ref: '#/components/examples/Device'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+  '/devices/{id}':
+    get:
+      description: Returns the device identified by id
+      tags:
+        - devices
+      summary: Represents a device
+      operationId: devicesGetById
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: id
+          in: path
+          description: Item ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Device'
+              examples:
+                Water:
+                  $ref: '#/components/examples/Device'
+        '404':
+          $ref: '#/components/responses/NotFound'
+    delete:
+      description: Deletes given device and returns remaining devices of the user
+      tags:
+        - devices
+      summary: Deletes device
+      operationId: devicesDeviceDelete
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: id
+          in: path
+          description: Item id
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/devices'
+              example:
+                Devices:
+                  $ref: '#/components/examples/devices'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '404':
+          $ref: '#/components/responses/NotFound'
+  /logs:
+    get:
+      description: Returns all log metadata
+      tags:
+        - logs
+      summary: Find logs by
+      operationId: logsGet
+      parameters:
+        - name: submitter
+          in: query
+          schema:
+            $ref: '#/components/schemas/username'
+          example: autotests
+        - $ref: '#/components/parameters/orderBy'
+        - $ref: '#/components/parameters/offset'
+        - $ref: '#/components/parameters/limit'
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/logs'
+              examples:
+                Logs:
+                  $ref: '#/components/examples/logs'
+        '404':
+          $ref: '#/components/responses/NotFound'
+    post:
+      description: >-
+        Creates a new log from given meta data. The log entries itself, must be
+        uploaded per /logs/{log_id}
+      tags:
+        - logs
+      summary: Add a new log
+      operationId: logsLogCreate
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/LogCreation'
+      responses:
+        '201':
+          description: Log created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/LogMetaData'
+              examples:
+                LogMetaData:
+                  $ref: '#/components/examples/LogMetaData'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '413':
+          $ref: '#/components/responses/PayloadToLarge'
+  '/logs/{log_id}':
+    get:
+      description: Returns the log identified by id
+      tags:
+        - logs
+      summary: Represents a log
+      operationId: logsLogGetById
+      parameters:
+        - name: log_id
+          in: path
+          description: Log ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Log'
+              examples:
+                Log:
+                  $ref: '#/components/examples/Log'
+            application/geo+json:
+              schema:
+                $ref: '#/components/schemas/LogGeoJson'
+              examples:
+                Log:
+                  $ref: '#/components/examples/LogGeoJson'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '404':
+          $ref: '#/components/responses/NotFound'
+    post:
+      description: Adds log entries from uploaded file to current Log
+      tags:
+        - logs
+      summary: Add a new log entries
+      operationId: logsLogUpload
+      parameters:
+        - name: log_id
+          in: path
+          description: Log ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      requestBody:
+        content:
+          text/plain:
+            schema:
+              type: string
+              format: binary
+      responses:
+        '201':
+          description: Logs uploaded
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/LogMetaData'
+              examples:
+                Log:
+                  $ref: '#/components/examples/LogMetaData'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+    delete:
+      description: Deletes given log and returns remaining logs of the gauge
+      tags:
+        - logs
+      summary: Deletes log
+      operationId: logsLogDelete
+      security:
+        - basicAuth: []
+        - apiKeyAuth: []
+      parameters:
+        - name: log_id
+          in: path
+          description: Log ID
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 1
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/logs'
+              example:
+                Devices:
+                  $ref: '#/components/examples/logs'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '404':
+          $ref: '#/components/responses/NotFound'
+  '/tiles/gnuboat/{accuracy}/{resolution}/{zoom}/{x_tile}/{y_tile}.png':
+    get:
+      description: 'Returns the map tile x_tile, y_tile at Zoomlevel zoom'
+      tags:
+        - tiles
+      summary: Represents a tile
+      operationId: tilesTileGet
+      parameters:
+        - name: accuracy
+          in: path
+          description: Accuracy of generated tiles
+          required: true
+          schema:
+            title: >-
+              Accuracy of the tiles (for a higher accuracy more measured points per square meter are needed to generate a pixel of water depth)
+            type: string
+            enum:
+              - 'high'
+              - 'low'
+          example: 'high'
+        - name: resolution
+          in: path
+          description: Resolution of the tiles
+          required: true
+          schema:
+            title: >-
+              Tile Resolution (Pixel per Tile) (Placed here, because
+              codegenerator could use Enums in components/schemas
+            type: integer
+            format: int32
+            enum:
+              - 256
+              - 512
+          example: 256
+        - name: zoom
+          in: path
+          description: Zoomlevel
+          required: true
+          schema:
+            $ref: '#/components/schemas/tileZoomlevel'
+          example: 15
+        - name: x_tile
+          in: path
+          description: Number of the tile in x dimension
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 17298
+        - name: y_tile
+          in: path
+          description: Number of the tile in y dimension
+          required: true
+          schema:
+            $ref: '#/components/schemas/itemId'
+          example: 21435
+      responses:
+        '200':
+          description: OK
+          content:
+            image/*:
+              schema:
+                type: string
+                format: binary
+                #contentEncoding: base64
+                #contentMediaType: image/png
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '404':
+          $ref: '#/components/responses/NotFound'
+        '500':
+          $ref: '#/components/responses/InternalServerError'
+components:
+  securitySchemes:
+    basicAuth:
+      type: http
+      scheme: basic
+      x-basicInfoFunc: gnuboat.mapservice_impl.security.Security.auth_basic
+    apiKeyAuth:
+      type: apiKey
+      in: header
+      name: X-API-KEY
+      x-apikeyInfoFunc: gnuboat.mapservice_impl.security.Security.auth_api
+  schemas:
+    username:
+      title: Username
+      type: string
+    apiKey:
+      title: API Key
+      type: string
+    apiKeys:
+      title: Array of API keys
+      type: array
+      items:
+        $ref: '#/components/schemas/apiKey'
+    activationCode:
+      title: Activation code for a User
+      type: string
+    itemId:
+      title: Item ID
+      type: integer
+      format: int64
+    itemName:
+      title: Item Name
+      type: string
+    itemBase:
+      title: 'Basic, generic item data'
+      type: object
+      properties:
+        label:
+          type: string
+          description: >-
+            A representative name, for the item, which could be understand by
+            the user. Mostly it should be the itemName
+        id:
+          $ref: '#/components/schemas/itemId'
+        url:
+          type: string
+          format: url
+          description: 'Url, where details of the object could be retrieved'
+      required:
+        - label
+        - id
+    order:
+      title: order
+      enum:
+        - desc
+        - asc
+      type: string
+      default: asc
+      description: |
+        Sort order:
+          * `asc` - Ascending, from A to Z
+          * `desc` - Descending, from Z to A
+      example: asc
+    osmType:
+      title: OSM type of item (N|W|R)
+      type: string
+      enum:
+        - Node
+        - Way
+        - Relation
+    comment:
+      title: Comment of an item
+      type: string
+    point:
+      title: 'Point of type [longitude, latitude]'
+      type: array
+      maxItems: 2
+      minItems: 2
+      items:
+        type: number
+    geoJsonType:
+      title: Type of GeoJSON objects
+      type: string
+      enum:
+        - Feature
+        - Point
+        - FeatureCollection
+    geoJsonPoint:
+      type: object
+      description: GeoJson geometry
+      externalDocs:
+        url: 'http://geojson.org/geojson-spec.html#id2'
+      properties:
+        type:
+          type: string
+        coordinates:
+          $ref: '#/components/schemas/point'
+    sensorDepth:
+      type: number
+      title: Depth of sensor beneath water level in cm (positive means below water)
+      minimum: 0
+    User:
+      title: User
+      type: object
+      properties:
+        username:
+          $ref: '#/components/schemas/username'
+        email:
+          type: string
+        firstName:
+          type: string
+        lastName:
+          type: string
+        activated:
+          type: boolean
+        licenseAccepted:
+          type: boolean
+        apiKeys:
+          $ref: '#/components/schemas/apiKeys'
+    UserCreation:
+      title: User
+      type: object
+      properties:
+        username:
+          $ref: '#/components/schemas/username'
+        email:
+          type: string
+        firstName:
+          type: string
+        lastName:
+          type: string
+        password:
+          type: string
+        licenseAccepted:
+          type: boolean
+      required:
+        - username
+        - email
+        - firstName
+        - lastName
+        - password
+        - licenseAccepted
+      example:
+        username: 'john_doe'
+        firstName: 'John'
+        lastName: 'Doe'
+        password: '1234'
+        licenseAccepted: True
+        email: 'john.doe@example.org'
+    Water:
+      title: Water
+      type: object
+      properties:
+        waterId:
+          $ref: '#/components/schemas/itemId'
+        name:
+          $ref: '#/components/schemas/itemName'
+        manager:
+          $ref: '#/components/schemas/username'
+        osmId:
+          $ref: '#/components/schemas/itemId'
+        osmType:
+          $ref: '#/components/schemas/osmType'
+        gauges:
+          $ref: '#/components/schemas/Gauges'
+        logs:
+          $ref: '#/components/schemas/logs'
+      required:
+        - waterId
+        - name
+    WaterCreation:
+      title: Water for Creation
+      type: object
+      properties:
+        name:
+          $ref: '#/components/schemas/itemName'
+        osmId:
+          $ref: '#/components/schemas/itemId'
+        osmType:
+          $ref: '#/components/schemas/osmType'
+      required:
+        - name
+      example:
+        name: 'Water for auto generated tests'
+        osmId: 1756854
+        osmType: Relation
+    waters:
+      title: waters
+      type: array
+      items:
+        $ref: '#/components/schemas/Water'
+    ReferenceWaterLevelGaugeHeight:
+      title: Gauge Height of reference water level of a Gauge
+      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.
+      type: number
+      format: float
+    Gauge:
+      title: Gauge
+      type: object
+      properties:
+        gaugeId:
+          $ref: '#/components/schemas/itemId'
+        name:
+          $ref: '#/components/schemas/itemName'
+        manager:
+          $ref: '#/components/schemas/username'
+        location:
+          $ref: '#/components/schemas/point'
+        referenceWaterLevelGaugeHeight:
+          $ref: '#/components/schemas/ReferenceWaterLevelGaugeHeight'
+        logs:
+          $ref: '#/components/schemas/logs'
+        comment:
+          $ref: '#/components/schemas/comment'
+      required:
+        - gaugeId
+        - name
+        - location
+        - referenceWaterLevelGaugeHeight
+    GaugeCreation:
+      title: Gauge for Creation
+      type: object
+      properties:
+        name:
+          $ref: '#/components/schemas/itemName'
+        location:
+          $ref: '#/components/schemas/point'
+        referenceWaterLevelGaugeHeight:
+          $ref: '#/components/schemas/ReferenceWaterLevelGaugeHeight'
+        water:
+          $ref: '#/components/schemas/itemId'
+        comment:
+          $ref: '#/components/schemas/comment'
+      required:
+        - name
+        - location
+      example:
+        name: 'Gauge for auto generated tests'
+        location:
+          - 90.136111
+          - 29.934722
+        water: 1
+        referenceWaterLevelGaugeHeight: 666
+    Gauges:
+      title: Gauges
+      type: array
+      items:
+        $ref: '#/components/schemas/Gauge'
+    GaugeGeoJson:
+      title: Gauge in GeoJson format
+      type: object
+      properties:
+        type:
+          $ref: '#/components/schemas/geoJsonType'
+        geometry:
+          $ref: '#/components/schemas/geoJsonPoint'
+        properties:
+          type: object
+          properties:
+            name:
+              $ref: '#/components/schemas/itemName'
+            manager:
+              $ref: '#/components/schemas/username'
+            referenceWaterLevelGaugeHeight:
+              $ref: '#/components/schemas/ReferenceWaterLevelGaugeHeight'
+            comment:
+              $ref: '#/components/schemas/comment'
+          required:
+            - name
+      required:
+        - type
+        - geometry
+        - properties
+    GaugesGeoJson:
+      title: Gauges in GeoJson format
+      type: array
+      items:
+        $ref: '#/components/schemas/GaugeGeoJson'
+    Device:
+      title: Device
+      type: object
+      properties:
+        deviceId:
+          $ref: '#/components/schemas/itemId'
+        name:
+          $ref: '#/components/schemas/itemName'
+        sensorDepth:
+          $ref: '#/components/schemas/sensorDepth'
+        logs:
+          $ref: '#/components/schemas/logs'
+        comment:
+          $ref: '#/components/schemas/comment'
+      required:
+        - deviceId
+        - name
+        - sensorDepth
+    DeviceCreation:
+      title: Device for Creation
+      type: object
+      properties:
+        name:
+          $ref: '#/components/schemas/itemName'
+        sensorDepth:
+          $ref: '#/components/schemas/sensorDepth'
+        comment:
+          $ref: '#/components/schemas/comment'
+      required:
+        - name
+        - sensorDepth
+      example:
+        name: 'Device for auto generated tests'
+        sensorDepth: 0.2
+        comment: 'Device for auto generated tests'
+    devices:
+      title: Devices
+      type: array
+      items:
+        $ref: '#/components/schemas/Device'
+    GaugeHeight:
+      title: 'Gauge height (stage) of the gauge, at the time of measuring'
+      type: number
+      format: float
+    LogEntry:
+      title: Measurement in a Log
+      type: object
+      properties:
+        datetime:
+          type: string
+          format: date-time
+        location:
+          $ref: '#/components/schemas/point'
+        waterDepth:
+          title: Measured water depth at current position
+          type: number
+          format: float
+      required:
+        - datetime
+        - location
+    LogMetaData:
+      title: 'Metadata of a log, without log entries'
+      type: object
+      properties:
+        logId:
+          $ref: '#/components/schemas/itemId'
+        submitter:
+          $ref: '#/components/schemas/username'
+        water:
+          $ref: '#/components/schemas/itemBase'
+        device:
+          $ref: '#/components/schemas/itemBase'
+        gauge:
+          $ref: '#/components/schemas/itemBase'
+        gaugeHeight:
+          $ref: '#/components/schemas/GaugeHeight'
+        start:
+          title: Date and Time of the first log entry in UTC timezone
+          type: string
+          format: date-time
+          nullable: true
+        end:
+          title: Date and Time of the last log entry in UTC timezone
+          type: string
+          format: date-time
+          nullable: true
+        processingState:
+          $ref: '#/components/schemas/itemBase'
+        entriesCount:
+          title: Number of measurings in the log
+          type: integer
+          format: int64
+        comment:
+          $ref: '#/components/schemas/comment'
+      required:
+        - gaugeHeight
+        - start
+        - end
+        - entriesCount
+    Log:
+      title: A collection of LogEntries
+      type: object
+      properties:
+        metaData:
+          $ref: '#/components/schemas/LogMetaData'
+        entries:
+          title: Log entries
+          type: array
+          items:
+            $ref: '#/components/schemas/LogEntry'
+      required:
+        - metaData
+        - entries
+    LogCreation:
+      title: Log for Creation
+      type: object
+      properties:
+        water:
+          $ref: '#/components/schemas/itemId'
+        device:
+          $ref: '#/components/schemas/itemId'
+        gauge:
+          $ref: '#/components/schemas/itemId'
+        gaugeHeight:
+          $ref: '#/components/schemas/GaugeHeight'
+        comment:
+          $ref: '#/components/schemas/comment'
+      required:
+        - water
+        - device
+        - gauge
+        - gaugeHeight
+      example:
+        water: 1
+        device: 1
+        gauge: 1
+        gaugeHeight: 66
+        comment: 'LogCreation for auto generated tests'
+    logs:
+      title: Logs
+      type: array
+      items:
+        $ref: '#/components/schemas/LogMetaData'
+    LogGeoJson:
+        title: FeatureCollection representing a Log in GeoJson format
+        type: object
+        properties:
+          type:
+            $ref: '#/components/schemas/geoJsonType'
+          features:
+            type: array
+            items:
+              $ref: '#/components/schemas/LogEntryGeoJson'
+        required:
+          - type
+          - features
+    LogEntryGeoJson:
+      title: Feature representing LogEntry in GeoJson format
+      type: object
+      properties:
+        type:
+          $ref: '#/components/schemas/geoJsonType'
+        geometry:
+          $ref: '#/components/schemas/geoJsonPoint'
+        properties:
+          type: object
+          properties:
+            datetime:
+              type: string
+              format: date-time
+            waterDepth:
+              type: number
+              format: float
+          required:
+            - datetime
+      required:
+        - type
+        - geometry
+        - properties
+    tileZoomlevel:
+      title: Zoomlevel of requested Tile
+      type: integer
+      format: int32
+      minimum: 0
+      maximum: 19
+    HttpError:
+      title: HTTP Error Response Object
+      type: object
+      properties:
+        type:
+          type: string
+        title:
+          type: string
+        detail:
+          type: string
+        instance:
+          type: string
+      required:
+        - type
+        - title
+        - detail
+        - instance
+  parameters:
+    orderBy:
+      name: order_by
+      in: query
+      description: 'Order by field: name'
+      schema:
+        type: string
+        default: name
+        example: name
+    order:
+      name: order
+      in: query
+      description: Order
+      schema:
+        $ref: '#/components/schemas/order'
+      example: ''
+    offset:
+      name: offset
+      in: query
+      description: >-
+        Skip over a number of elements by specifying an offset value for the
+        query
+      schema:
+        type: integer
+        format: int32
+        default: 0
+        example: 0
+    limit:
+      name: limit
+      in: query
+      description: Limit the number of elements on the response
+      style: form
+      explode: true
+      schema:
+        type: integer
+        format: int32
+        default: 10
+        example: 10
+  examples:
+    User:
+      value:
+        username: jane
+        email: jane@example.org
+        firstName: Jane
+        lastName: Doe
+        activated: True
+        apiKeys:
+          - ApiKey4701
+    UserCreation:
+      value:
+        username: richard
+        email: richard@examle.org
+        firstName: Richard
+        lastName: Roe
+        password: sdfl.1238_ASDkeil?
+        licenseAccepted: True
+    Water:
+      value:
+        waterId: 1
+        name: Mississippi
+        osmId: 1756854
+        osmType: R
+      summary: A water example object
+    WaterCreation:
+      value:
+        name: Mississippi
+        osmId: 1756854
+        osmType: Relation
+      summary: A water example object for creation of a water
+    waters:
+      value:
+        - waterId: 1
+          name: Mississippi
+          osmId: 1756854
+          osmType: Relation
+        - waterId: 2
+          name: Bodensee
+      summary: A sample list with waters
+    Gauge:
+      value:
+        gaugeId: 1
+        name: New Orleans
+        manager: jane
+        location:
+          - 90.136111
+          - 29.934722
+        referenceWaterLevelGaugeHeight: 5.1
+        comment: Gauge for Mississippi in New Orleans
+    Gauges:
+      value:
+        - gaugeId: 1
+          name: New Orleans
+          manager: jane
+          location:
+            - 90.136111
+            - 29.934722
+          referenceWaterLevelGaugeHeight: 5.1
+      summary: A sample list of gauges
+    GaugeGeoJson:
+      value:
+        type: Feature
+        geometry:
+          type: Point
+          coordinates:
+            - 90.136111
+            - 29.934722
+          properties:
+            name: New Orleans
+            manager: jane
+            referenceWaterLevelGaugeHeight: 5.1
+            comment: Gauge for Mississippi in New Orleans
+    GaugesGeoJson:
+      value:
+        - type: Feature
+          geometry:
+            type: Point
+            coordinates:
+              - 90.136111
+              - 29.934722
+            properties:
+              name: New Orleans
+              manager: jane
+              referenceWaterLevelGaugeHeight: 5.1
+              comment: Gauge for Mississippi in New Orleans
+      summary: A sample list of gauges in GeoJson format
+    Device:
+      value:
+        deviceId: 1
+        name: Lovely Boat
+        sensorDepth: 0.2
+        comment: Really a pleasure to measure
+      summary: A sample device
+    devices:
+      value:
+        - deviceId: 1
+          name: Lovely Boat
+          sensorDepth: 0.2
+          comment: Really a pleasure to measure
+    LogMetaData:
+      value:
+        logId: 1
+        submitter:
+          userId: 1
+          name: Jane
+        device:
+          deviceId: 1
+          name: Lovely Boat
+          sensorDepth: 0.2
+        gauge:
+          gaugeId: 1
+          name: New Orleans
+          manager: jane
+          location:
+            - 90.136111
+            - 29.934722
+        gaugeHeight: 8
+        start: 2017-07-21T10:32:28.000Z
+        end: 2017-07-21T17:32:28.000Z
+        entriesCount: 12600
+    Log:
+      value:
+        metaData:
+          logId: 1
+          submitter:
+            userId: 1
+            name: Jane
+          device:
+            deviceId: 1
+            name: Lovely Boat
+            sensorDepth: 0.2
+          gauge:
+            gaugeId: 1
+            name: New Orleans
+            manager: jane
+            location:
+              - 90.136111
+              - 29.934722
+          gaugeHeight: 8
+          start: 2017-07-21T10:32:28.000Z
+          end: 2017-07-21T17:32:28.000Z
+          entriesCount: 1
+        entries:
+          - datetime: null
+            location:
+              - 90.136111
+              - 29.934722
+            waterDepth: 10
+    LogCreation:
+      value:
+        water: 1
+        device: 1
+        gauge: 1
+        gaugeHeight: 666
+        comment: 'This is an Example for LogCreation'
+    LogGeoJson:
+      value:
+        type: FeatureCollection
+        features:
+          - geometry:
+              coordinates:
+                - 90.136111
+                - 29.934722
+              type: 'Point'
+            properties:
+              datetime: 2017-07-21T10:32:28.000Z
+              waterDepth: 10
+          - geometry:
+              coordinates:
+                - 90.236111
+                - 30.034722
+              type: Point
+            properties:
+              datetime: 2017-07-21T11:32:28.000Z
+              waterDepth: 5
+    logs:
+      value:
+        - logId: 1
+          submitter:
+            userId: 1
+            name: Jane
+          device:
+            deviceId: 1
+            name: Lovely Boat
+            sensorDepth: 0.2
+          gauge:
+            gaugeId: 1
+            name: New Orleans
+            manager: jane
+            location:
+              - 90.136111
+              - 29.934722
+          gaugeHeight: 8
+          start: 2017-07-21T10:32:28.000Z
+          end: 2017-07-21T17:32:28.000Z
+          entriesCount: 12600
+    HttpError:
+      value:
+        type: 'http://example.com/waters/not-found'
+        title: Water 1 not found
+        detail: There is no water with id 1 in database
+        instance: 'http://example.net/waters/1'
+  responses:
+    BadRequest:
+      description: Bad Request (400)
+      content:
+        application/problem+json:
+          schema:
+            $ref: '#/components/schemas/HttpError'
+          examples:
+            HttpError:
+              $ref: '#/components/examples/HttpError'
+    Unauthorized:
+      description: Unauthorized (401) acces to resource
+      content:
+        application/problem+json:
+          schema:
+            $ref: '#/components/schemas/HttpError'
+          examples:
+            HttpError:
+              $ref: '#/components/examples/HttpError'
+    NotFound:
+      description: Item with given Id not found
+      content:
+        application/problem+json:
+          schema:
+            $ref: '#/components/schemas/HttpError'
+          examples:
+            HttpError:
+              $ref: '#/components/examples/HttpError'
+    PayloadToLarge:
+      description: Uploaded file is to large (413)
+      content:
+        application/problem+json:
+          schema:
+            $ref: '#/components/schemas/HttpError'
+    InternalServerError:
+      description: Internal Server Error (HTTP Code 500)
+      content:
+        application/problem+json:
+          schema:
+            $ref: '#/components/schemas/HttpError'
+          examples:
+            HttpError:
+              $ref: '#/components/examples/HttpError'
+tags:
+  - name: waters
+    description: >-
+      A water is a river (like Mississippi, lake (Lake Ontario), or a sea (North
+      Sea)
+  - name: users
+    description: All actions used to manage users and api keys
+  - name: devices
+    description: All actions used to manage devices of an user
+  - name: logs
+    description: 'All actions used to manage logs of an water, device, gauge or user'
+  - name: tiles
+    description: Tile serving
