devexperts / swagger-codegen-ts

Typesafe Swagger API generator for TypeScript
Mozilla Public License 2.0
80 stars 16 forks source link

`examples` key in the Message object is not parsed correctly #154

Closed kokovtsev closed 2 years ago

kokovtsev commented 2 years ago

According to the AsyncAPI 2.0.0 spec, examples should be an array of records. Current swagger-codegen-ts implementation expects a single record.

Sample spec:

asyncapi: 2.0.0
defaultContentType: application/json
info:
  title: swagger-codegen-ts - messages schema
  version: 1.0.0

channels:
  /demo:
    publish:
      message:
        summary: Provides a way to test the communication channel between the client and the server
        payload:
          type: object
          properties:
            type:
              const: ping
          required:
            - type
        examples:
          - payload: |
          {
            "type": "ping"
          }
          ```
kokovtsev commented 2 years ago

Update: this seems to be broken somewhere between io-ts-types@0.5.1, io-ts@2.0.1 and io-ts-types@0.5.16, io-ts@2.2.16