mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 14:09:21 +00:00
openapi2jsonschema.py now correctly fails if no FILE is passed
This commit is contained in:
parent
2e50b79b16
commit
781246882e
2 changed files with 9 additions and 2 deletions
|
|
@ -72,3 +72,10 @@ setup() {
|
|||
run diff prometheus_v1.json ./fixtures/prometheus_v1-denyRootAdditionalProperties.json
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "Should output an error if no file is passed" {
|
||||
run ./openapi2jsonschema.py
|
||||
[ "$status" -eq 1 ]
|
||||
[ "${lines[0]}" == 'Missing FILE parameter.' ]
|
||||
[ "${lines[1]}" == 'Usage: ./openapi2jsonschema.py [FILE]' ]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ def construct_value(load, node):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 0:
|
||||
print("missing file")
|
||||
if len(sys.argv) < 2:
|
||||
print('Missing FILE parameter.\nUsage: %s [FILE]' % sys.argv[0])
|
||||
exit(1)
|
||||
|
||||
for crdFile in sys.argv[1:]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue