mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-25 12:47:01 +00:00
update openapi2schema script
This commit is contained in:
parent
b4995aa02c
commit
86106b9293
2 changed files with 10 additions and 3 deletions
|
|
@ -263,7 +263,7 @@ func realMain() int {
|
||||||
|
|
||||||
var o output.Output
|
var o output.Output
|
||||||
if o, err = getLogger(outputFormat, summary, verbose); err != nil {
|
if o, err = getLogger(outputFormat, summary, verbose); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
def iteritems(d):
|
def iteritems(d):
|
||||||
if hasattr(dict, "iteritems"):
|
if hasattr(dict, "iteritems"):
|
||||||
|
|
@ -83,9 +84,15 @@ def append_no_duplicates(obj, key, value):
|
||||||
if value not in obj[key]:
|
if value not in obj[key]:
|
||||||
obj[key].append(value)
|
obj[key].append(value)
|
||||||
|
|
||||||
with open(r'synced_secrets.yaml') as f:
|
|
||||||
|
if len(sys.argv) == 0:
|
||||||
|
print("missing file")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
with open(sys.argv[1]) as f:
|
||||||
y = yaml.load(f, Loader=yaml.SafeLoader)
|
y = yaml.load(f, Loader=yaml.SafeLoader)
|
||||||
schema = y["spec"]["validation"]["openAPIV3Schema"]
|
schema = y["spec"]["validation"]["openAPIV3Schema"]
|
||||||
schema = additional_properties(schema)
|
schema = additional_properties(schema)
|
||||||
schema = replace_int_or_string(schema)
|
schema = replace_int_or_string(schema)
|
||||||
print(json.dumps(schema))
|
print(json.dumps(schema))
|
||||||
|
exit(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue