openapi: 3.0.0
info:
  version: 1.4.1
  title: boats
  description: A sample API
  contact:
    name: Swagger API Team
    email: john@boats.io
    url: 'https://github.com/johndcarmichael/boats/'
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
servers:
  - url: localhost
tags:
  - name: weather
    description: Weather data
paths:
  /weather/:
    get:
      tags:
        - Weather
      summary: weather data
      description: Get the latest temperatures
      operationId: weatherGet
      parameters:
        - $ref: '#/components/parameters/headerSearchId'
      responses:
        '200':
          description: Successful fetch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Weathers'
        '404':
          description: Temp not found
    post:
      tags:
        - Weather
      summary: weather data
      description: Create a new weather record.
      operationId: weatherPost
      requestBody:
        description: Optional description in *Markdown*
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WeatherPost'
      responses:
        '200':
          description: Successful temp creation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Weather'
        '422':
          description: Invalid form data provided
  '/weather/id/{id}':
    get:
      tags:
        - Weather
      summary: weather data
      description: Get the latest temperatures
      operationId: weatherIdGet
      parameters:
        - $ref: '#/components/parameters/pathId'
      responses:
        '200':
          description: Successful fetch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Weather'
        '404':
          description: Temp not found
    put:
      tags:
        - Weather
      summary: weather data
      description: Create a new weather record.
      operationId: weatherIdPut
      requestBody:
        description: Optional description in *Markdown*
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WeatherPut'
      responses:
        '200':
          description: Successful temp creation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Weather'
        '422':
          description: Invalid form data provided
components:
  parameters:
    queryOffset:
      in: query
      name: offset
      required: false
      schema:
        type: integer
        minimum: 0
      description: The number of items to skip before starting to collect the result set.
    pathId:
      in: path
      name: id
      schema:
        type: integer
      required: true
      description: Numeric ID of object to fetch
    headerSearchId:
      in: header
      name: Search-Id
      schema:
        type: string
      description: Unique search id
      x-example: 569eecd9-9962-4aed-a0f0-30476c6a82ed
  schemas:
    GenericSearchMeta:
      type: object
      properties:
        totalResultCount:
          type: number
        offset:
          type: number
        limit:
          type: number
    Weather:
      type: object
      properties:
        id:
          type: integer
        date:
          type: string
          format: date
        location:
          type: string
        cloudCoverPercentage:
          type: integer
        humidityPercentage:
          type: integer
        temperature:
          type: number
    Weathers:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/GenericSearchMeta'
        data:
          type: array
          items:
            $ref: '#/components/schemas/Weather'
    WeatherPost:
      type: object
      properties:
        date:
          type: string
          format: date
        location:
          type: string
        cloudCoverPercentage:
          type: integer
        humidityPercentage:
          type: integer
        temperature:
          type: number
    WeatherPut:
      allOf:
        - $ref: '#/components/schemas/WeatherPost'
        - type: object
          properties:
            id:
              type: integer
