anymaniax / 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
2.29k stars 257 forks source link

Zod: Components override not working #1299

Open Arnagos opened 3 weeks ago

Arnagos commented 3 weeks ago

What are the steps to reproduce this issue?

  1. Generate with the following settings
    Validators: {
    input: { target: './swagger.json' },
    output: {
      mode: 'tags',
      target: 'src/schemas/api',
      client: 'zod',
      indexFiles: false,
      prettier: true,
      override: {
        components: {
          responses: { suffix: 'ResponseSchema' },
          parameters: { suffix: 'ParamsSchema' },
          requestBodies: { suffix: 'BodiesSchema' }
        }
      }
    }

What happens?

The suffix overrides defined are not respected. Instead of i.e. ***ResponseSchema I still get ***Response.

What were you expecting to happen?

I expect the override to be respected.

Any logs, error output, etc

None

Any other comments?

What versions are you using?

Operating System: Windows 11 Package Version: 6.26.0 Browser Version: n/a

anymaniax commented 3 weeks ago

it's not exactly the same since on zod we don't handle the schemas with the components section but directly on each path. We could add an option to do it with zod too.