hey-api / openapi-ts

🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more. Support: @mrlubos
https://heyapi.dev
Other
1.39k stars 107 forks source link

[experimentalParser] Transformers warning: ... is too complex and won't be currently processed #1259

Open mrclrchtr opened 1 week ago

mrclrchtr commented 1 week ago

Description

Hi,

I tried the experimentalParser: true.

I receive many warnings about incomplete transformer produced.

It seems to be enums with or or and operator:

Transformers warning: schema {"type":"enum","items":[{"type":"string","const":"INVOICE"},{"type":"string","const":"DELIVERY"}],"logicalOperator":"or"} is too complex and won't be currently processed.
Transformers warning: schema {"items":[{"$ref":"#/components/schemas/OrderItemDto"},{"type":"object","properties":{"cuttingLengthId":{"format":"int32","type":"number"},"humidityLevelId":{"format":"int32","type":"number"},"price":{"type":"number"},"priceOverride":{"type":"number"},"unitOfMeasurement":{"type":"enum","items":[{"type":"string","const":"SOLID_CUBIC_METER"},{"type":"string","const":"STACKED_CUBIC_METER"},{"type":"string","const":"LOOSE_CUBIC_METER"}],"logicalOperator":"or"},"volume":{"type":"number"},"woodTypeId":{"format":"int32","type":"number"}}}],"logicalOperator":"and"} is too complex and won't be currently processed. 

Do you need more infos?

OpenAPI specification (optional)

    OrderItemDto:
      type: object
      discriminator:
        propertyName: type
      properties:
        orderItemId:
          type: integer
          format: int32
        price:
          type: number
        priceOverride:
          type: number
        type:
          type: string
      required:
      - orderItemId
      - price
      - type
    OrderItemWoodDto:
      type: object
      allOf:
      - $ref: "#/components/schemas/OrderItemDto"
      - type: object
        properties:
          cuttingLengthId:
            type: integer
            format: int32
          humidityLevelId:
            type: integer
            format: int32
          price:
            type: number
            exclusiveMinimum: true
            minimum: 0.00
          priceOverride:
            type: number
            exclusiveMinimum: false
            minimum: 0.00
          unitOfMeasurement:
            type: string
            enum:
            - SOLID_CUBIC_METER
            - STACKED_CUBIC_METER
            - LOOSE_CUBIC_METER
          volume:
            type: number
            exclusiveMinimum: true
            minimum: 0.00
          woodTypeId:
            type: integer
            format: int32

System information (optional)

"@hey-api/openapi-ts": "0.55.1"

stackblitz[bot] commented 1 week ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

mrlubos commented 1 week ago

@mrclrchtr Is this OpenAPI 3.0? And to be clear, are you setting up the project for the first time or these warnings don't happen with the current parser and the transformer gets generated?

mrclrchtr commented 1 week ago

Thx for the fast reply.

I have been using HeyAPI for a long time and the warnings do not occur with the old parser. The transformers gets generated in the types.gen.ts file.

mrlubos commented 1 week ago

For those enums with warnings, can you provide the original OpenAPI specification? The sample you shared doesn't have the same enum values so I assume it's a different part of spec

mrclrchtr commented 1 week ago

Yes, for sure. I created the minimal example: https://stackblitz.com/edit/hey-api-client-fetch-example-a7jmdo?file=package.json

simply run npm run openapi-ts and the errors will occur.