Skip to content
Snippets Groups Projects

ENH: JsonSchemaExporter accepts do_not_create parameter.

Merged Daniel Hornung requested to merge f-more-jsonschema-export into dev
5 unresolved threads
Files
4
@@ -268,6 +268,9 @@ class DataModel(dict):
This methods only uses data which is available in this datamodel, which acts kind of like a
cache pool.
Note that this may change this data model (subsequent "get" like calls may also return deep
content.)
"""
entity = self.get(name)
if not entity:
@@ -281,8 +284,15 @@ class DataModel(dict):
continue
visited.add(prop.name)
if prop.name in self:
entity.remove_property(prop).add_property(self.get_deep(prop.name,
visited=visited))
deep_prop = self.get_deep(prop.name, visited=visited)
linked_prop = entity.get_property(prop)
if not linked_prop.datatype:
if deep_prop.role == "Property":
linked_prop.datatype = deep_prop.datatype
elif deep_prop.role == "RecordType":
linked_prop.datatype = deep_prop
if deep_prop.description:
linked_prop.description = deep_prop.description
else:
print(f"Referenced property \"{prop.name}\" not found in data model.")
return entity
Loading