openapi: 3.0.0
info:
  contact:
    email: info@engsas.de
    name: EngSaS - Engineering Solutions and Services Langenbach
    url: http://www.engsas.com
  description: API to upload log files with water depth to GNUBoat server
  license:
    name: GPL 3
    url: https://www.gnu.org/licenses/gpl-3.0.en.html
  title: GNUBoat Mapservice API
  version: v1
servers:
- description: The production API server
  url: https://gnuboat.engsas.com/mapservice/{version}
  variables:
    version:
      default: v1
- description: The local flask development url
  url: http://localhost:8080/mapservice/{version}
  variables:
    version:
      default: v1
tags:
- description: A water is a river (like Mississippi, lake (Lake Ontario), or a sea (North Sea)
  name: waters
paths:
  /waters:
    get:
      description: Returns all waters
      operationId: waters_get
      parameters:
      - explode: false
        in: header
        name: name
        required: false
        schema:
          $ref: '#/components/schemas/item_name'
        style: simple
      - explode: false
        in: header
        name: manager
        required: false
        schema:
          $ref: '#/components/schemas/username'
        style: simple
      - description: 'Order by field: name'
        explode: true
        in: query
        name: orderBy
        required: false
        schema:
          default: name
          type: string
        style: form
      - description: Skip over a number of elements by specifying an offset value for the query
        explode: true
        in: query
        name: offset
        required: false
        schema:
          default: 0
          example: 0
          format: int32
          type: integer
        style: form
      - description: Limit the number of elements on the response
        explode: true
        in: query
        name: limit
        required: false
        schema:
          default: 10
          example: 10
          format: int32
          type: integer
        style: form
      responses:
        200:
          content:
            application/json:
              examples:
                Waters:
                  $ref: '#/components/examples/waters'
              schema:
                $ref: '#/components/schemas/waters'
          description: OK
      summary: Find waters by id
      tags:
      - waters
      x-openapi-router-controller: openapi_server.controllers.waters_controller
    post:
      description: Adds a new water to the database
      operationId: waters_post
      requestBody:
        content:
          application/json:
            examples:
              Water:
                $ref: '#/components/examples/WaterCreation'
            schema:
              $ref: '#/components/schemas/WaterCreation'
        description: item id of water is going to be ignored
      responses:
        201:
          content:
            application/json:
              examples:
                Water:
                  $ref: '#/components/examples/Water'
              schema:
                $ref: '#/components/schemas/Water'
          description: Water created
        400:
          content:
            application/json:
              examples:
                HttpError:
                  $ref: '#/components/examples/HttpError'
              schema:
                $ref: '#/components/schemas/HttpError'
          description: Bad Request (400)
        401:
          content:
            application/json:
              examples:
                HttpError:
                  $ref: '#/components/examples/HttpError'
              schema:
                $ref: '#/components/schemas/HttpError'
          description: Unauthorized (401) acces to resource
      security:
      - basicAuth: []
      - apiKeyAuth: []
      summary: Add a new water
      tags:
      - waters
      x-openapi-router-controller: openapi_server.controllers.waters_controller
  /waters/{id}:
    get:
      description: Returns the water identified by id
      operationId: water_get_by_id
      parameters:
      - description: Item ID
        explode: false
        in: path
        name: id
        required: true
        schema:
          $ref: '#/components/schemas/item_id'
        style: simple
      responses:
        200:
          content:
            application/json:
              examples:
                Water:
                  $ref: '#/components/examples/Water'
              schema:
                $ref: '#/components/schemas/Water'
          description: OK
        404:
          content:
            application/json:
              examples:
                HttpError:
                  $ref: '#/components/examples/HttpError'
              schema:
                $ref: '#/components/schemas/HttpError'
          description: Water with given Id not found
      summary: Represents a water
      tags:
      - waters
      x-openapi-router-controller: openapi_server.controllers.waters_controller
components:
  examples:
    Water:
      summary: A water example object
      value:
        water_id: 1
        name: Mississippi
        osm_id: 1756854
        osm_type: R
        link: http://gnuboat.engsas.com/mapservice/v1/waters/1
    WaterCreation:
      summary: A water example object for creation of a water
      value:
        name: Mississippi
        osm_id: 1756854
        osm_type: R
    waters:
      summary: A sample list with waters
      value:
      - water_id: 1
        name: Mississippi
        osm_id: 1756854
        osm_type: R
        link: http://gnuboat.engsas.com/mapservice/v1/waters/1
      - water_id: 2
        name: Bodensee
        link: http://gnuboat.engsas.com/mapservice/v1/waters/2
    HttpError:
      value:
        code: 404
        message: Water with id 999999 not found
  parameters:
    orderBy:
      description: 'Order by field: name'
      explode: true
      in: query
      name: orderBy
      required: false
      schema:
        default: name
        type: string
      style: form
    order:
      description: Order
      explode: true
      in: query
      name: order
      required: false
      schema:
        $ref: '#/components/schemas/order'
      style: form
    offset:
      description: Skip over a number of elements by specifying an offset value for the query
      explode: true
      in: query
      name: offset
      required: false
      schema:
        default: 0
        example: 0
        format: int32
        type: integer
      style: form
    limit:
      description: Limit the number of elements on the response
      explode: true
      in: query
      name: limit
      required: false
      schema:
        default: 10
        example: 10
        format: int32
        type: integer
      style: form
  responses:
    BadRequest:
      content:
        application/json:
          examples:
            HttpError:
              $ref: '#/components/examples/HttpError'
          schema:
            $ref: '#/components/schemas/HttpError'
      description: Bad Request (400)
    Unauthorized:
      content:
        application/json:
          examples:
            HttpError:
              $ref: '#/components/examples/HttpError'
          schema:
            $ref: '#/components/schemas/HttpError'
      description: Unauthorized (401) acces to resource
    NotFound:
      content:
        application/json:
          examples:
            HttpError:
              $ref: '#/components/examples/HttpError'
          schema:
            $ref: '#/components/schemas/HttpError'
      description: Water with given Id not found
  schemas:
    username:
      title: Username
      type: string
    item_id:
      format: int32
      title: Item ID
      type: integer
    item_name:
      title: Item Name
      type: string
    osm_type:
      maxLength: 1
      minLength: 1
      type: string
    Water:
      example:
        osm_id: 6
        osm_type: osm_type
        manager: manager
        name: name
        water_id: 0
        osm_class: osm_class
      properties:
        water_id:
          format: int32
          title: Item ID
          type: integer
        name:
          title: Item Name
          type: string
        manager:
          title: Username
          type: string
        osm_id:
          format: int32
          title: Item ID
          type: integer
        osm_type:
          maxLength: 1
          minLength: 1
          type: string
        osm_class:
          maxLength: 1
          minLength: 1
          type: string
      required:
      - name
      - water_id
      title: Water
      type: object
    WaterCreation:
      example:
        osm_id: 0
        osm_type: osm_type
        name: name
      properties:
        name:
          title: Item Name
          type: string
        osm_id:
          format: int32
          title: Item ID
          type: integer
        osm_type:
          maxLength: 1
          minLength: 1
          type: string
      required:
      - name
      title: Water
      type: object
    waters:
      items:
        $ref: '#/components/schemas/Water'
      title: waters
      type: array
    order:
      default: asc
      description: |
        Sort order:
          * `asc` - Ascending, from A to Z
          * `desc` - Descending, from Z to A
      enum:
      - desc
      - asc
      example: asc
      title: order
      type: string
    HttpError:
      properties:
        code:
          format: int32
          type: integer
        message:
          type: string
      required:
      - code
      - message
      title: HTTP Error Response Object
      type: object
  securitySchemes:
    basicAuth:
      scheme: basic
      type: http
      x-basicInfoFunc: openapi_server.server_impl.security.Security.auth_basic
    apiKeyAuth:
      in: header
      name: X-API-KEY
      type: apiKey
      x-apikeyInfoFunc: openapi_server.server_impl.security.Security.auth_api
