Skip to content

Commit

Permalink
fix(export): include additionalProperties in json schema when its set…
Browse files Browse the repository at this point in the history
… on a TOSCA datatype
  • Loading branch information
aszs committed Oct 23, 2023
1 parent 55e7e84 commit 5120b5f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions unfurl/to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ def tosca_schema_to_jsonschema(p: PropertyDef, custom_defs: CustomDefs):
if is_property_user_visible(p)
]
type_schema = tosca_type_to_jsonschema(custom_defs, propdefs, dt.type)
metadata = dt.get_value('metadata', parent=True)
if metadata and 'additionalProperties' in metadata:
schema["additionalProperties"] = dict(type="string", required=True)
if len(type_schema["properties"]) == 1 and "$toscatype" in type_schema["properties"]:
del type_schema["properties"] # XXX remove this temporary hack
if tosca_type not in ONE_TO_ONE_TYPES and "properties" not in schema:
schema["$toscatype"] = tosca_type
schema.update(type_schema)
Expand Down

0 comments on commit 5120b5f

Please sign in to comment.