$GENERATED_YAML_COMMENT

openapi: 3.0.0
info:
  title: hv2-api
  version: "1"
  description: "REST-API for the Nober Grundbesitz GbR Hausverwaltungs-Software"
  termsOfService: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:termsofuse"
  contact: 
    name: "Wolfgang Hottgenroth"
    email:  "wolfgang.hottgenroth@icloud.com"
externalDocs:
  description: "Find more details here"
  url: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:externaldocs"

paths:
#for $table in $tables
  /v1/${table.name}s:
    get:
      tags: [ "$table.name" ]
      summary: Return all normalized ${table.name}s
      operationId: methods.get_${table.name}s
      responses:
        '200':
          description: ${table.name}s response
          content:
            'application/json':
              schema:
                type: array
                items:
                  \$ref: '#/components/schemas/$table.name'
      security:
      - jwt: ['secret']
    post:
      tags: [ "$table.name" ]
      summary: Insert a ${table.name}
      operationId: methods.insert_${table.name}
      requestBody:
        description: $table.name
        content:
          application/json:
            schema:
              \$ref: '#/components/schemas/$table.name'
      responses:
        '200':
          description: ${table.name} successfully inserted
          content:
            'application/json':
              schema:
                type: array
                items:
                  \$ref: '#/components/schemas/$table.name'
      security:
      - jwt: ['secret']
  /v1/${table.name}s/{${table.name}Id}:
    get:
      tags: [ "$table.name" ]
      summary: Return the normalized $table.name with given id
      operationId: methods.get_$table.name
      parameters:
        - name: ${table.name}Id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: $table.name response
          content:
            'application/json':
              schema:
                type: array
                items:
                  \$ref: '#/components/schemas/$table.name'
      security:
      - jwt: ['secret']
#end for

components:
  securitySchemes:
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      x-bearerInfoFunc: auth.decodeToken
  schemas:
#for $table in $tables    
    $table.name:
      description: $table.name
      type: object
      properties:
        id:
          type: integer
#for $column in $table.columns
        $column.name:
          type: $column.apitype
#end for
#end for