openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

.redocly.lint-ignore.yaml file not respected when generating types

Open riverajo opened this issue 8 months ago • 2 comments

openapi-typescript version

7.6.1

Node.js version

v22.12.0

OS + version

Linux

Description

We've recently started to try to improve our API specs. We are using redcoly for linting. It appears that openapi-typescript also lints internally when generating types using redocly. After adding a redocly.yaml and setting the - recommended, type generation is failing. We've created an ignore file per: https://redocly.com/docs/cli/commands/lint, but openapi-typescript does not appears to be respecting the file and lint failures stop type generation. perhaps they need to be filtered out here: https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/src/lib/redoc.ts#L85-L102

My spec technically passes, however you do get a warning

Woohoo! Your API description is valid. 🎉 5 problems are explicitly ignored.

Reproduction

  • Create a simple spec with lint errors, but is valid
  • generate an ignore file using redocly cli
  • attempt to generate types

Expected result

openapi-typescript internal linting would also respect the redocly's .redocly.lint-ignore.yaml

Required

  • [x] My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

riverajo avatar Mar 04 '25 19:03 riverajo

Are you generating the types using the openapi-typescript CLI, or with the node.js interface?

duncanbeevers avatar Mar 04 '25 20:03 duncanbeevers

The cli npx [email protected]

riverajo avatar Mar 04 '25 20:03 riverajo

I've tried to open the PR, but it's not as straightforward as it seems.

134130 avatar Mar 17 '25 07:03 134130