Make Registry description optional
Currently, parse_registries.py assumes the description property exists
in every registry json it parses. However, according to the spec [1]
it is not a required property, so it may not exist, see [2].
Switch it to optional and use an empty string as a default value.
Testing:
Ran the script and made sure the generated files remain unchanged.
[1] https://redfish.dmtf.org/schemas/v1/MessageRegistry.v1_4_0.json
[2] Run: `curl https://redfish.dmtf.org/schemas/v1/MessageRegistry.v1_4_0.json | jq .definitions.MessageRegistry.required`
Change-Id: I3e9ba84bbdb9ba5e6ed8b00cde48c15a1b5abba6
Signed-off-by: Igor Kanyuka <ifelmail@gmail.com>
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index a07803f..a557f65 100755
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -98,6 +98,7 @@
registry.write(REGISTRY_HEADER.format(namespace))
# Parse the Registry header info
+ description = json_dict.get("Description", "")
registry.write(
"const Header header = {{\n"
' "{json_dict[@Redfish.Copyright]}",\n'
@@ -107,7 +108,7 @@
" {version_split[2]},\n"
' "{json_dict[Name]}",\n'
' "{json_dict[Language]}",\n'
- ' "{json_dict[Description]}",\n'
+ ' "{description}",\n'
' "{json_dict[RegistryPrefix]}",\n'
' "{json_dict[OwningEntity]}",\n'
"}};\n"
@@ -119,6 +120,7 @@
json_dict=json_dict,
url=url,
version_split=version_split,
+ description=description,
)
)