Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI option to validate existing file #1738

Open
1 task done
markedwards opened this issue Jun 28, 2024 · 3 comments
Open
1 task done

CLI option to validate existing file #1738

markedwards opened this issue Jun 28, 2024 · 3 comments
Labels
enhancement New feature or request openapi-ts Relevant to the openapi-typescript library

Comments

@markedwards
Copy link

markedwards commented Jun 28, 2024

Description

There's no apparent way to validate that the existing generated types in the target file match the current schema. This is useful in a CI pipeline.

Proposal

A validation mode triggered by a --validate should do the trick. This would change the behavior from updating the file at the output path, to validating that its contents match the output that would be generated from the current schema. If the file doesn't exist, or if there is any difference, an error should be emitted.

Checklist

@markedwards markedwards added enhancement New feature or request openapi-ts Relevant to the openapi-typescript library labels Jun 28, 2024
@markedwards
Copy link
Author

It's easy to get a rudimentary variant of this functionality running using the API. I would be willing to assist with this feature, but I don't know all of the complexity involved in rolling it in to the CLI at this point.

@markedwards
Copy link
Author

If this is as straightforward as it seems to me, after doing my own implementation, then I'm happy to do a PR for it. As I envision it, the --validate flag would require either:

  1. a valid redocly.yaml (in which case all defined apis will be validated and any failure would throw an error)
  2. the --output flag to be specified

@drwpow
Copy link
Contributor

drwpow commented Jun 30, 2024

I’d love a PR for this! @markedwards I agree with your take on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

2 participants