From 824be75d537947249937f94c90357902fe43ca46 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 30 Mar 2021 17:04:05 +0200 Subject: [PATCH 1/4] created new project config schema validating new keys --- schema/config-2.0.json | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 schema/config-2.0.json diff --git a/schema/config-2.0.json b/schema/config-2.0.json new file mode 100644 index 0000000000..098d1983e2 --- /dev/null +++ b/schema/config-2.0.json @@ -0,0 +1,87 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + + "title": "pype:config-2.0", + "description": "A project configuration.", + + "type": "object", + + "additionalProperties": false, + "required": [ + "tasks", + "apps" + ], + + "properties": { + "schema": { + "description": "Schema identifier for payload", + "type": "string" + }, + "templates": { + "type": "object" + }, + "roots": { + "type": "object" + }, + "imageio": { + "type": "object" + }, + "tasks": { + "type": "object", + "items": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "icon": {"type": "string"}, + "group": {"type": "string"}, + "label": {"type": "string"} + }, + "required": [ + "short_name" + ] + } + }, + "apps": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "icon": {"type": "string"}, + "group": {"type": "string"}, + "label": {"type": "string"} + }, + "required": ["name"] + } + }, + "families": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "icon": {"type": "string"}, + "label": {"type": "string"}, + "hideFilter": {"type": "boolean"} + }, + "required": ["name"] + } + }, + "groups": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "icon": {"type": "string"}, + "color": {"type": "string"}, + "order": {"type": ["integer", "number"]} + }, + "required": ["name"] + } + }, + "copy": { + "type": "object" + } + } +} From 43ac74c752e7bbd93f788e098091d3b6fcde49ce Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 30 Mar 2021 17:04:22 +0200 Subject: [PATCH 2/4] created new project schema using new config reference --- schema/project-3.0.json | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 schema/project-3.0.json diff --git a/schema/project-3.0.json b/schema/project-3.0.json new file mode 100644 index 0000000000..d6368d665c --- /dev/null +++ b/schema/project-3.0.json @@ -0,0 +1,59 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + + "title": "pype:project-3.0", + "description": "A unit of data", + + "type": "object", + + "additionalProperties": true, + + "required": [ + "schema", + "type", + "name", + "data", + "config" + ], + + "properties": { + "schema": { + "description": "Schema identifier for payload", + "type": "string", + "enum": ["pype:project-3.0"], + "example": "pype:project-3.0" + }, + "type": { + "description": "The type of document", + "type": "string", + "enum": ["project"], + "example": "project" + }, + "parent": { + "description": "Unique identifier to parent document", + "example": "592c33475f8c1b064c4d1696" + }, + "name": { + "description": "Name of directory", + "type": "string", + "pattern": "^[a-zA-Z0-9_.]*$", + "example": "hulk" + }, + "data": { + "description": "Document metadata", + "type": "object", + "example": { + "fps": 24, + "width": 1920, + "height": 1080 + } + }, + "config": { + "type": "object", + "description": "Document metadata", + "$ref": "config-2.0.json" + } + }, + + "definitions": {} +} From 302a00c9c95a032deb2966f18e7e9f3582b0fdc8 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 30 Mar 2021 17:04:58 +0200 Subject: [PATCH 3/4] sync to avalon is using new schemas --- pype/modules/ftrack/lib/avalon_sync.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pype/modules/ftrack/lib/avalon_sync.py b/pype/modules/ftrack/lib/avalon_sync.py index 970a270290..43e02283c2 100644 --- a/pype/modules/ftrack/lib/avalon_sync.py +++ b/pype/modules/ftrack/lib/avalon_sync.py @@ -31,9 +31,9 @@ log = Logger.get_logger(__name__) # Current schemas for avalon types EntitySchemas = { - "project": "pype:project-2.1", + "project": "pype:project-3.0", "asset": "pype:asset-3.0", - "config": "pype:config-1.1" + "config": "pype:config-2.0" } # Group name of custom attributes From 7a45a1a0e7003c198efa2aa07943b446e5a7b371 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 30 Mar 2021 17:05:19 +0200 Subject: [PATCH 4/4] anatomy handler can handle not existing projects --- pype/settings/handlers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pype/settings/handlers.py b/pype/settings/handlers.py index 6e93f2f405..0a60f6ab2c 100644 --- a/pype/settings/handlers.py +++ b/pype/settings/handlers.py @@ -610,6 +610,9 @@ class MongoSettingsHandler(SettingsHandler): Probably should fill missing keys and values. """ + if not project_doc: + return {} + attributes = {} project_doc_data = project_doc.get("data") or {} for key in self.attribute_keys: