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

Validation of dynamic items in settings #1462

Merged
merged 5 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -167,8 +167,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