Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1462 from pypeclub/bugfix/dynamic_item_schema_val…
Browse files Browse the repository at this point in the history
…idations
  • Loading branch information
mkolar authored May 4, 2021
2 parents 0a6c1ef + 6f69cad commit c535417
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 18 deletions.
14 changes: 12 additions & 2 deletions openpype/settings/entities/dict_mutable_keys_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,18 @@ def schema_validations(self):
)
raise EntitySchemaError(self, reason)

for child_obj in self.children_by_key.values():
child_obj.schema_validations()
# Validate object type schema
child_validated = False
for child_entity in self.children_by_key.values():
child_entity.schema_validations()
child_validated = True
break

if not child_validated:
key = "__tmp__"
tmp_child = self._add_key(key)
tmp_child.schema_validations()
self.children_by_key.pop(key)

def get_child_path(self, child_obj):
result_key = None
Expand Down
14 changes: 12 additions & 2 deletions openpype/settings/entities/list_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,18 @@ def schema_validations(self):
)
raise EntitySchemaError(self, reason)

for child_obj in self.children:
child_obj.schema_validations()
# Validate object type schema
child_validated = False
for child_entity in self.children:
child_entity.schema_validations()
child_validated = True
break

if not child_validated:
idx = 0
tmp_child = self._add_new_item(idx)
tmp_child.schema_validations()
self.children.pop(idx)

def get_child_path(self, child_obj):
result_idx = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@
"label": "Used in plugins",
"object_type": {
"type": "text",
"key": "pluginClass",
"label": "Plugin Class"
"key": "pluginClass"
}
},
{
Expand Down Expand Up @@ -295,8 +294,7 @@
"label": "Used in plugins",
"object_type": {
"type": "text",
"key": "pluginClass",
"label": "Plugin Class"
"key": "pluginClass"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"key": "filters",
"label": "Publish GUI Filters",
"object_type": {
"type": "raw-json",
"label": "Plugins"
"type": "raw-json"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"object_type": {
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "schema_template",
Expand Down

0 comments on commit c535417

Please sign in to comment.