Ignore:
Timestamp:
Nov 10, 2019, 5:32:37 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
ac11efe
Parents:
c774a9e
Message:

Added Log API (only to API, not implemented yet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mapservice/openapi.yaml

    rc774a9e r72cc339  
    375375        '400':
    376376          $ref: '#/components/responses/BadRequest'
     377        '404':
     378          $ref: '#/components/responses/NotFound'
     379    post:
     380      description: Adds a new log to the database
     381      tags:
     382        - waters
     383      summary: Add a new log
     384      operationId: watersCreateLog
     385      parameters:
     386        - name: water_id
     387          in: path
     388          description: Water ID
     389          required: true
     390          schema:
     391            $ref: '#/components/schemas/itemId'
     392        - name: gauge_id
     393          in: path
     394          description: Gauge ID
     395          required: true
     396          schema:
     397            $ref: '#/components/schemas/itemId'
     398      security:
     399        - basicAuth: []
     400        - apiKeyAuth: []
     401      requestBody:
     402        content:
     403          multipart/form-data:
     404            schema:
     405              type: object
     406              properties:
     407                metaData:
     408                  $ref: '#/components/schemas/LogCreation'
     409                file:
     410                  type: string
     411                  format: binary
     412      responses:
     413        '201':
     414          description: Log created
     415          content:
     416            application/json:
     417              schema:
     418                $ref: '#/components/schemas/LogMetaData'
     419              examples:
     420                LogMetaData:
     421                  $ref: '#/components/examples/LogMetaData'
     422        '400':
     423          $ref: '#/components/responses/BadRequest'
     424        '401':
     425          $ref: '#/components/responses/Unauthorized'
     426  '/waters/{water_id}/gauges/{gauge_id}/{log_id}':
     427    get:
     428      description: Returns the log identified by id
     429      tags:
     430        - waters
     431      summary: Represents a log
     432      operationId: watersLogGetById
     433      parameters:
     434        - name: water_id
     435          in: path
     436          description: Water ID
     437          required: true
     438          schema:
     439            $ref: '#/components/schemas/itemId'
     440        - name: gauge_id
     441          in: path
     442          description: Gauge ID
     443          required: true
     444          schema:
     445            $ref: '#/components/schemas/itemId'
     446        - name: log_id
     447          in: path
     448          description: Log ID
     449          required: true
     450          schema:
     451            $ref: '#/components/schemas/itemId'
     452      responses:
     453        '200':
     454          description: OK
     455          content:
     456            application/json:
     457              schema:
     458                $ref: '#/components/schemas/Log'
     459              examples:
     460                Log:
     461                  $ref: '#/components/examples/Log'
     462            application/geo+json:
     463              schema:
     464                $ref: '#/components/schemas/LogGeoJson'
     465              examples:
     466                Log:
     467                  $ref: '#/components/examples/LogGeoJson'
     468        '400':
     469          $ref: '#/components/responses/BadRequest'
     470        '404':
     471          $ref: '#/components/responses/NotFound'
     472    delete:
     473      description: Deletes given log and returns remaining logs of the gauge
     474      tags:
     475        - waters
     476      summary: Deletes log
     477      operationId: watersLogDelete
     478      security:
     479        - basicAuth: []
     480        - apiKeyAuth: []
     481      parameters:
     482        - name: water_id
     483          in: path
     484          description: Water ID
     485          required: true
     486          schema:
     487            $ref: '#/components/schemas/itemId'
     488        - name: gauge_id
     489          in: path
     490          description: Gauge ID
     491          required: true
     492          schema:
     493            $ref: '#/components/schemas/itemId'
     494        - name: log_id
     495          in: path
     496          description: Log ID
     497          required: true
     498          schema:
     499            $ref: '#/components/schemas/itemId'
     500      responses:
     501        '200':
     502          description: OK
     503          content:
     504            application/json:
     505              schema:
     506                $ref: '#/components/schemas/logs'
     507              example:
     508                Devices:
     509                  $ref: '#/components/examples/logs'
     510        '400':
     511          $ref: '#/components/responses/BadRequest'
     512        '401':
     513          $ref: '#/components/responses/Unauthorized'
    377514        '404':
    378515          $ref: '#/components/responses/NotFound'
    … …  
    569706        - Feature
    570707        - Point
     708        - LineString
    571709    geoJsonPoint:
    572710      type: object
    573       description: GeoJSon geometry
     711      description: GeoJson geometry
    574712      externalDocs:
    575713        url: 'http://geojson.org/geojson-spec.html#id2'
    … …  
    579717        coordinates:
    580718          $ref: '#/components/schemas/point'
     719    geoJsonLineString:
     720      type: object
     721      description: GeoJson geometry
     722      externalDocs:
     723        url: 'http://geojson.org/geojson-spec.html#id3'
     724      properties:
     725        type:
     726          type: string
     727        coordinates:
     728          type: array
     729          items:
     730            $ref: '#/components/schemas/point'
    581731    sensorDepth:
    582732      type: number
    … …  
    635785        gauges:
    636786          $ref: '#/components/schemas/Gauges'
     787        logs:
     788          $ref: '#/components/schemas/LogMetaData'
    637789      required:
    638790        - waterId
    … …  
    667819        location:
    668820          $ref: '#/components/schemas/point'
     821        logs:
     822          $ref: '#/components/schemas/LogMetaData'
    669823        comment:
    670824          $ref: '#/components/schemas/comment'
    … …  
    692846        $ref: '#/components/schemas/Gauge'
    693847    GaugeGeoJson:
    694       title: Gauge
     848      title: Gauge in GeoJson format
    695849      type: object
    696850      properties:
    … …  
    753907      items:
    754908        $ref: '#/components/schemas/Device'
     909    GaugeLevel:
     910      title: 'Absolute Level of the gauge, at the time of measuring'
     911      type: number
     912      format: float
     913    LogEntry:
     914      title: Measurement in a Log
     915      type: object
     916      properties:
     917        datetime:
     918          type: string
     919          format: date-time
     920        location:
     921          $ref: '#/components/schemas/point'
     922        waterDepth:
     923          title: Measured water depth at current position
     924          type: number
     925          format: float
     926    LogMetaData:
     927      title: 'Metadata of a log, without log entries'
     928      type: object
     929      properties:
     930        logId:
     931          $ref: '#/components/schemas/itemId'
     932        submitter:
     933          $ref: '#/components/schemas/User'
     934        water:
     935          $ref: '#/components/schemas/itemId'
     936        device:
     937          $ref: '#/components/schemas/itemId'
     938        gauge:
     939          $ref: '#/components/schemas/itemId'
     940        gaugeLevel:
     941          $ref: '#/components/schemas/GaugeLevel'
     942        start:
     943          title: Date and Time of the first log entry
     944          type: string
     945          format: date-time
     946        end:
     947          title: Date and Time of the last log entry
     948          type: string
     949          format: date-time
     950        entriesCount:
     951          title: Number of measurings in the log
     952          type: integer
     953          format: int64
     954        comment:
     955          $ref: '#/components/schemas/comment'
     956      required:
     957        - gaugeLevel
     958        - start
     959        - end
     960        - entriesCount
     961    Log:
     962      title: A collection of LogEntries
     963      type: object
     964      properties:
     965        metaData:
     966          $ref: '#/components/schemas/LogMetaData'
     967        entries:
     968          title: Log entries
     969          type: array
     970          items:
     971            $ref: '#/components/schemas/LogEntry'
     972      required:
     973        - metaData
     974        - entries
     975    LogCreation:
     976      title: Log for Creation
     977      type: object
     978      properties:
     979        water:
     980          $ref: '#/components/schemas/Water'
     981        device:
     982          $ref: '#/components/schemas/Device'
     983        gauge:
     984          $ref: '#/components/schemas/Gauge'
     985        gaugeLevel:
     986          $ref: '#/components/schemas/GaugeLevel'
     987        comment:
     988          $ref: '#/components/schemas/comment'
     989      required:
     990        - water
     991        - device
     992        - gauge
     993        - gaugeLevel
     994    logs:
     995      title: Logs
     996      type: array
     997      items:
     998        $ref: '#/components/schemas/Log'
     999    LogGeoJson:
     1000      title: Log in GeoJson format
     1001      type: object
     1002      properties:
     1003        type:
     1004          $ref: '#/components/schemas/geoJsonType'
     1005        geometry:
     1006          $ref: '#/components/schemas/geoJsonLineString'
     1007        properties:
     1008          type: object
     1009          additionalProperties:
     1010            type: object
     1011            properties:
     1012              name:
     1013                type: string
     1014              item:
     1015                title: >-
     1016                  LogEntry as GeoJson property ordered in same order as geometry
     1017                  coordinates
     1018                type: object
     1019                properties:
     1020                  datetime:
     1021                    type: string
     1022                    format: date-time
     1023                  waterDepth:
     1024                    $ref: '#/components/schemas/itemName'
     1025                  comment:
     1026                    $ref: '#/components/schemas/comment'
     1027                required:
     1028                  - datetime
     1029                  - waterDepth
     1030      required:
     1031        - type
     1032        - geometry
     1033        - properties
    7551034    HttpError:
    7561035      title: HTTP Error Response Object
    … …  
    7581037      properties:
    7591038        type:
    760             type: string
     1039          type: string
    7611040        title:
    762             type: string
     1041          type: string
    7631042        detail:
    764             type: string
     1043          type: string
    7651044        instance:
    766             type: string
     1045          type: string
    7671046      required:
    7681047        - type
    … …  
    9031182          sensorDepth: 0.2
    9041183          comment: Really a pleasure to measure
     1184    LogMetaData:
     1185      value:
     1186        logId: 1
     1187        submitter:
     1188          userId: 1
     1189          name: Jane
     1190        device:
     1191          deviceId: 1
     1192          name: Lovely Boat
     1193          sensorDepth: 0.2
     1194        gauge:
     1195          gaugeId: 1
     1196          name: New Orleans
     1197          manager: jane
     1198          location:
     1199            - 90.136111
     1200            - 29.934722
     1201        gaugeLevel: 8
     1202        start: 2017-07-21T10:32:28.000Z
     1203        end: 2017-07-21T17:32:28.000Z
     1204        entriesCount: 12600
     1205    Log:
     1206      value:
     1207        metaData:
     1208          logId: 1
     1209          submitter:
     1210            userId: 1
     1211            name: Jane
     1212          device:
     1213            deviceId: 1
     1214            name: Lovely Boat
     1215            sensorDepth: 0.2
     1216          gauge:
     1217            gaugeId: 1
     1218            name: New Orleans
     1219            manager: jane
     1220            location:
     1221              - 90.136111
     1222              - 29.934722
     1223          gaugeLevel: 8
     1224          start: 2017-07-21T10:32:28.000Z
     1225          end: 2017-07-21T17:32:28.000Z
     1226          entriesCount: 1
     1227          entries:
     1228            - datetime: null
     1229              location:
     1230                - 90.136111
     1231                - 29.934722
     1232              waterDepth: 10
     1233    LogGeoJson:
     1234      value:
     1235        type: Feature
     1236        geometry:
     1237          type: LineString
     1238          coordinates:
     1239            - - 90.136111
     1240              - 29.934722
     1241            - - 90.236111
     1242              - 30.034722
     1243          properties:
     1244            prop0:
     1245              datetime: 2017-07-21T10:32:28.000Z
     1246              waterDepth: 10
     1247            prop1:
     1248              datetime: 2017-07-21T11:32:28.000Z
     1249              waterDepth: 5
     1250    logs:
     1251      value:
     1252        - logId: 1
     1253          submitter:
     1254            userId: 1
     1255            name: Jane
     1256          device:
     1257            deviceId: 1
     1258            name: Lovely Boat
     1259            sensorDepth: 0.2
     1260          gauge:
     1261            gaugeId: 1
     1262            name: New Orleans
     1263            manager: jane
     1264            location:
     1265              - 90.136111
     1266              - 29.934722
     1267          gaugeLevel: 8
     1268          start: 2017-07-21T10:32:28.000Z
     1269          end: 2017-07-21T17:32:28.000Z
     1270          entriesCount: 12600
    9051271    HttpError:
    9061272      value:
    907         type: "http://example.com/waters/not-found"
    908         title: "Water 1 not found"
    909         detail: "There is no water with id 1 in database"
    910         instance: "http://example.net/waters/1"
     1273        type: 'http://example.com/waters/not-found'
     1274        title: Water 1 not found
     1275        detail: There is no water with id 1 in database
     1276        instance: 'http://example.net/waters/1'
    9111277  responses:
    9121278    BadRequest:
Note: See TracChangeset for help on using the changeset viewer.