openapi: 3.0.0
info:
  version: '1'
  title: 'Schulung API'

paths: 
  /schulungen/:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Schulung'
      responses:
        201:
          description: Created
    get:
      responses:
        200:
          description: Ok
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Schulung'
  /schulungen/{sid}: 
    parameters:
      - name: sid
        in: path
        required: true
        schema:
          type: integer
    get:
      responses:
        200:
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schulung'

components:
  schemas: 
    Schulung:
      type: object
      required:
      - id
      - name
      - datum
      - trainer
      properties:
        id:
          type: integer
          example: 234
        name:
          type: string
          example: REST & API Sicherheit
        datum:
          type: string
          format: date
          example: '2020-03-11'
        trainer:
          type: object
          required:
          - name
          - uri
          properties:
            name:
              type: string
              example: Till Born
            uri:
              type: string
              format: uri
              example: ttp://api.predic8.de/trainer/8
