mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-20 02:17:01 +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
|
run diff prometheus_v1.json ./fixtures/prometheus_v1-denyRootAdditionalProperties.json
|
||||||
[ "$status" -eq 0 ]
|
[ "$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 __name__ == "__main__":
|
||||||
if len(sys.argv) == 0:
|
if len(sys.argv) < 2:
|
||||||
print("missing file")
|
print('Missing FILE parameter.\nUsage: %s [FILE]' % sys.argv[0])
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
for crdFile in sys.argv[1:]:
|
for crdFile in sys.argv[1:]:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue