Closed channyein87 closed 1 year ago
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.
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
I see the issue now.
Thanks! As this is very useful, can you release a version 0.6.1 with this fix?
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).