orval-labs / orval

orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺
https://orval.dev
MIT License
3.18k stars 336 forks source link

Output mode 'tags' issue when operation has multiple tags #1677

Open oliveira-m opened 3 weeks ago

oliveira-m commented 3 weeks ago

Duplicate operation are generated when Output mode is 'tags' and operation has multiples tags, which is allowed by OpenAPI.

What are the steps to reproduce this issue?

  1. set multiple tags on a operation: e.g.
    paths:
    /pets:
    get:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
        - listAll
  2. set output mode to 'tags'
  3. run

What happens?

the operation will be generated on both ./pets and ./listAll which causes the index.ts file to throw an error: Module './pets' has already exported a member named 'ListPetsParams'. Consider explicitly re-exporting to resolve the ambiguity.

What were you expecting to happen?

only the first tag should be used in this scenario to export types and functions thus avoiding duplication

Any other comments?

there could be a config to set which tag to use in this scenario.( future enhancement)

What versions are you using?

orval: 7.2.0

System: OS: macOS 14.6.1 CPU: (10) arm64 Apple M1 Max Memory: 137.88 MB / 32.00 GB Shell: 5.9 - /bin/zsh