flexiblepower / s2-ws-json

A WebSockets and JSON based protocol specification implementing the EN50491-12-2 "S2" standard for home and building energy management
Apache License 2.0
26 stars 2 forks source link

openapi message_type is defined as an enum instead of a const #17

Open lfse-slafleur opened 3 months ago

lfse-slafleur commented 3 months ago

The field message_type is currently defined as an enum in openapi.yml.

Example from line 807:

      properties:
        message_type:
          type: string
          enum: [ "DDBC.TimerStatus" ]

Rather a constant is expected such as:

        message_type:
          const: DDBC.TimerStatus
          type: string

A const is generated differently by generators such as datamodel-codegen. An enum will be generated to its own type and it is harder to use while a const will remain a simple string.