summaryrefslogtreecommitdiffstats
path: root/yaml2json.py
diff options
context:
space:
mode:
authorKeong Lim <keong.lim@huawei.com>2019-07-19 18:43:10 +1000
committerKeong Lim <keong.lim@huawei.com>2019-08-08 14:52:43 +1000
commitc44bcf608dc25c2047af65fbfdecba7dbce11e88 (patch)
tree6120423b356919b93b979e04a2c3ff6adbf4f5a3 /yaml2json.py
parent8d4ca0d78d2b34a07473d8a9293173c798d0a1f8 (diff)
AAI-2441 update swagger-format YAML generation
update swagger-format YAML generation so that conversion to JSON is cleaner, i.e. use n/a instead of null string in empty fields update tests to match new output with n/a values update generate-uml-snapshot.sh to also convert yaml to json add the generated json files Change-Id: Idd87ddae3c2d7490eb954ef69582edd8200f4df4 Issue-ID: AAI-2441 Signed-off-by: Keong Lim <keong.lim@huawei.com>
Diffstat (limited to 'yaml2json.py')
-rw-r--r--yaml2json.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/yaml2json.py b/yaml2json.py
new file mode 100644
index 0000000..2aa315e
--- /dev/null
+++ b/yaml2json.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# convert yaml to json
+# pip3 install pyyaml
+# http://pyyaml.org/wiki/PyYAMLDocumentation
+# py3 yaml2json.py < ~/code/manpow/homeland/heartland/puphpet/config.yaml
+# gist https://gist.github.com/noahcoad/51934724e0896184a2340217b383af73
+
+import yaml, json, sys
+sys.stdout.write(json.dumps(yaml.load(sys.stdin), sort_keys=True, indent=2))
+