Skip to content

Allow Multiple Spec Files #250

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

Closed
channyein87 opened this issue Jul 17, 2023 · 4 comments · Fixed by #255
Closed

Allow Multiple Spec Files #250

channyein87 opened this issue Jul 17, 2023 · 4 comments · Fixed by #255

Comments

@channyein87
Copy link

Is there a way to use pre-commit hook to run against multiple spec files? I have multiple spec files in the repo for deploying multiple API Gateways (e.g. api1.openapi.yaml, api2.openapi.yaml).

@p1c2u
Copy link
Collaborator

p1c2u commented Jul 17, 2023

Hi @channyein87

the hook should run against all files that meet the name pattern .*openapi.*\.(json|yaml|yml)

If you're looking for option that you can specify your files , there is no atm.

@channyein87
Copy link
Author

channyein87 commented Jul 24, 2023

Hi @p1c2u

Thanks for the reply.

I got the below error when trying to use multiple spec files. Please refer the sample test workflow below.
https://github.com/channyein87/temp/actions/runs/5639881716/job/15275717895#step:4:106

openapi-spec-validator...................................................Failed
- hook id: openapi-spec-validator
- exit code: 2

usage: openapi-spec-validator [-h] [--errors {best-match,all}]
                              [--schema {2.0,3.0.0,3.1.0,detect}]
                              filename
openapi-spec-validator: error: unrecognized arguments: src/openapi-specs/petstore-simple.openapi.yaml

I put the spec files in https://github.com/channyein87/temp/tree/openapi-spec-validator/src/openapi-specs

It looks like the pre-commit hook found the 2 spec files and pass to openapi-spec-validator.

openapi-spec-validator file1.yaml file2.yaml

@p1c2u
Copy link
Collaborator

p1c2u commented Jul 25, 2023

I see the issue now.

@guglie
Copy link

guglie commented Aug 8, 2023

Thanks! As this is very useful, can you release a version 0.6.1 with this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants