swagger-cli icon indicating copy to clipboard operation
swagger-cli copied to clipboard

pre-commit: no files to check

Open martin-thoma opened this issue 4 years ago • 2 comments

I've added this to my pre-commit config:

-   repo: https://github.com/APIDevTools/swagger-cli
    rev: v4.0.4
    hooks:
    - id: swagger-validation
      args: ["validate", "spec.yaml"]

When I run it manually, I get:

$ swagger-cli validate spec.yaml
Swagger schema validation failed. 
  Additional properties not allowed: putty at #/paths//foo/{id}/bar/{bar_id}
 
JSON_OBJECT_VALIDATION_FAILED

But with pre-commit I get:

$ pre-commit run --all          
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Check Xml............................................(no files to check)Skipped
Check JSON...........................................(no files to check)Skipped
Check for added large files..............................................Passed
Check for merge conflicts................................................Passed
isort....................................................................Passed
flake8...................................................................Passed
swagger-validation...................................(no files to check)Skipped

martin-thoma avatar Jun 29 '21 17:06 martin-thoma

I faced the same issue @MT-Cash . Looks like you would need to rename your spec.yamlto swagger-spec.yaml. It needs swagger in the file name according to the regex specified. That solved the issue for me.

pankajkoti avatar Aug 19 '21 19:08 pankajkoti

That makes it pretty useless to me, though

martin-thoma avatar Aug 20 '21 09:08 martin-thoma