mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
added few conditions so it is possbile to load dynamic schemas
This commit is contained in:
parent
f38c7a462e
commit
5541b3fd0c
3 changed files with 31 additions and 7 deletions
|
|
@ -841,10 +841,20 @@ class ItemEntity(BaseItemEntity):
|
|||
self._require_restart_on_change = require_restart_on_change
|
||||
|
||||
# File item reference
|
||||
if self.parent.is_file:
|
||||
self.file_item = self.parent
|
||||
elif self.parent.file_item:
|
||||
self.file_item = self.parent.file_item
|
||||
if not self.is_dynamic_schema_node:
|
||||
self.is_in_dynamic_schema_node = (
|
||||
self.parent.is_dynamic_schema_node
|
||||
or self.parent.is_in_dynamic_schema_node
|
||||
)
|
||||
|
||||
if (
|
||||
not self.is_dynamic_schema_node
|
||||
and not self.is_in_dynamic_schema_node
|
||||
):
|
||||
if self.parent.is_file:
|
||||
self.file_item = self.parent
|
||||
elif self.parent.file_item:
|
||||
self.file_item = self.parent.file_item
|
||||
|
||||
# Group item reference
|
||||
if self.parent.is_group:
|
||||
|
|
@ -903,7 +913,12 @@ class ItemEntity(BaseItemEntity):
|
|||
)
|
||||
raise EntitySchemaError(self, reason)
|
||||
|
||||
if self.is_file and self.file_item is not None:
|
||||
if (
|
||||
not self.is_dynamic_schema_node
|
||||
and not self.is_in_dynamic_schema_node
|
||||
and self.is_file
|
||||
and self.file_item is not None
|
||||
):
|
||||
reason = (
|
||||
"Entity has set `is_file` to true but"
|
||||
" it's parent is already marked as file item."
|
||||
|
|
|
|||
|
|
@ -116,7 +116,11 @@ class InputEntity(EndpointEntity):
|
|||
|
||||
def schema_validations(self):
|
||||
# Input entity must have file parent.
|
||||
if not self.file_item:
|
||||
if (
|
||||
not self.is_dynamic_schema_node
|
||||
and not self.is_in_dynamic_schema_node
|
||||
and self.file_item is None
|
||||
):
|
||||
raise EntitySchemaError(self, "Missing parent file entity.")
|
||||
|
||||
super(InputEntity, self).schema_validations()
|
||||
|
|
|
|||
|
|
@ -215,7 +215,12 @@ class ListStrictEntity(ItemEntity):
|
|||
|
||||
def schema_validations(self):
|
||||
# List entity must have file parent.
|
||||
if not self.file_item and not self.is_file:
|
||||
if (
|
||||
not self.is_dynamic_schema_node
|
||||
and not self.is_in_dynamic_schema_node
|
||||
and not self.is_file
|
||||
and self.file_item is None
|
||||
):
|
||||
raise EntitySchemaError(
|
||||
self, "Missing file entity in hierarchy."
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue