From a054b805adb5f12a65f2d244b07b0de765a09806 Mon Sep 17 00:00:00 2001 From: Eric Jansen Date: Fri, 29 Nov 2024 16:32:09 +0100 Subject: [PATCH] feat(nova): WIP custom validation rules for nova top, bottom, footwear --- schemas/assetBottom.nova.schema.json | 8 ++-- schemas/assetFootwear.nova.schema.json | 8 ++-- schemas/assetTop.nova.schema.json | 8 ++-- schemas/commonTexture.schema.json | 4 +- schemas/gltf-asset.schema.json | 2 +- schemas/materialNames.schema.json | 9 +++-- schemas/meshNames.schema.json | 31 ++++++++------- schemas/meshTriangleCount.schema.json | 55 ++++++++++++++------------ 8 files changed, 67 insertions(+), 58 deletions(-) diff --git a/schemas/assetBottom.nova.schema.json b/schemas/assetBottom.nova.schema.json index 3cdde70..923a5be 100644 --- a/schemas/assetBottom.nova.schema.json +++ b/schemas/assetBottom.nova.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "assetBottom.schema.json", + "$id": "assetBottom.nova.schema.json", "title": "Modular Bottom Outfit Asset", "description": "A Ready Player Me glTF binary validation schema for a bottom module of an outfit.", "type": "object", @@ -10,7 +10,7 @@ "type": "object", "properties": { "totalTriangleCount": { - "$ref": "meshTriangleCount.schema.json#/properties/nova/bottom" + "$ref": "meshTriangleCount.schema.json#/properties/nova/properties/bottom" }, "properties": { "$comment": "inspect() creates a 'properties' object. Do not confuse with the 'properties' keyword.", @@ -20,7 +20,7 @@ "properties": { "name": { "description": "Name of the mesh.", - "$ref": "meshNames.schema.json#/properties/nova/bottom" + "$ref": "meshNames.schema.json#/properties/nova/properties/bottom" }, "attributes": { "$ref": "meshAttributes.schema.json#/properties/skinned" @@ -59,7 +59,7 @@ "properties": { "name": { "description": "Name of the material.", - "$ref": "materialNames.schema.json#/properties/nova/bottom" + "$ref": "materialNames.schema.json#/properties/nova/properties/bottom" }, "textures": { "$ref": "commonMaterial.schema.json#/$defs/allTextureChannels" diff --git a/schemas/assetFootwear.nova.schema.json b/schemas/assetFootwear.nova.schema.json index 5af15e6..7ad917a 100644 --- a/schemas/assetFootwear.nova.schema.json +++ b/schemas/assetFootwear.nova.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "assetFootwear.schema.json", + "$id": "assetFootwear.nova.schema.json", "title": "Modular Footwear Outfit Asset", "description": "A Ready Player Me glTF binary validation schema for a footwear module of an outfit.", "type": "object", @@ -10,7 +10,7 @@ "type": "object", "properties": { "totalTriangleCount": { - "$ref": "meshTriangleCount.schema.json#/properties/nova/footwear" + "$ref": "meshTriangleCount.schema.json#/properties/nova/properties/footwear" }, "properties": { "$comment": "inspect() creates a 'properties' object. Do not confuse with the 'properties' keyword.", @@ -20,7 +20,7 @@ "properties": { "name": { "description": "Name of the mesh.", - "$ref": "meshNames.schema.json#/properties/nova/footwear" + "$ref": "meshNames.schema.json#/properties/nova/properties/footwear" }, "attributes": { "$ref": "meshAttributes.schema.json#/properties/skinned" @@ -59,7 +59,7 @@ "properties": { "name": { "description": "Name of the material.", - "$ref": "materialNames.schema.json#/properties/nova/footwear" + "$ref": "materialNames.schema.json#/properties/nova/properties/footwear" }, "textures": { "$ref": "commonMaterial.schema.json#/$defs/allTextureChannels" diff --git a/schemas/assetTop.nova.schema.json b/schemas/assetTop.nova.schema.json index 69a29d2..efd6a49 100644 --- a/schemas/assetTop.nova.schema.json +++ b/schemas/assetTop.nova.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "assetTop.schema.json", + "$id": "assetTop.nova.schema.json", "title": "Modular Top Outfit Asset", "description": "A Ready Player Me glTF binary validation schema for a top module of an outfit.", "type": "object", @@ -10,7 +10,7 @@ "type": "object", "properties": { "totalTriangleCount": { - "$ref": "meshTriangleCount.schema.json#/properties/nova/top" + "$ref": "meshTriangleCount.schema.json#/properties/nova/properties/top" }, "properties": { "$comment": "inspect() creates a 'properties' object. Do not confuse with the 'properties' keyword.", @@ -20,7 +20,7 @@ "properties": { "name": { "description": "Name of the mesh.", - "$ref": "meshNames.schema.json#/properties/nova/top" + "$ref": "meshNames.schema.json#/properties/nova/properties/top" }, "attributes": { "$ref": "meshAttributes.schema.json#/properties/skinned" @@ -59,7 +59,7 @@ "properties": { "name": { "description": "Name of the material.", - "$ref": "materialNames.schema.json#/properties/nova/top" + "$ref": "materialNames.schema.json#/properties/nova/properties/top" }, "textures": { "$ref": "commonMaterial.schema.json#/$defs/allTextureChannels" diff --git a/schemas/commonTexture.schema.json b/schemas/commonTexture.schema.json index 0149e3d..dae1b76 100644 --- a/schemas/commonTexture.schema.json +++ b/schemas/commonTexture.schema.json @@ -44,9 +44,9 @@ }, "size": { "type": "integer", - "maximum": 4194304, + "maximum": 12582912, "errorMessage": { - "maximum": "Texture map ${1/name} exceeds maximum allowed storage size of 4 MB." + "maximum": "Texture map ${1/name} exceeds maximum allowed storage size of 12 MB." } }, "gpuSize": { diff --git a/schemas/gltf-asset.schema.json b/schemas/gltf-asset.schema.json index bdbcf79..0dd783a 100644 --- a/schemas/gltf-asset.schema.json +++ b/schemas/gltf-asset.schema.json @@ -44,7 +44,7 @@ }, "required": ["bodyType"] }, - "than": { + "then": { "allOf": [ { "if": { diff --git a/schemas/materialNames.schema.json b/schemas/materialNames.schema.json index 4992819..90050b5 100644 --- a/schemas/materialNames.schema.json +++ b/schemas/materialNames.schema.json @@ -42,9 +42,12 @@ "errorMessage": "Material name should be one of 'Wolf3D_Body', 'Wolf3D_Outfit_Bottom', 'Wolf3D_Outfit_Footwear', 'Wolf3D_Outfit_Top'. Found ${0} instead." }, "nova": { - "bottom": { "type": "string", "const": "bottom", "errorMessage": "Material name should be 'bottom'. Found ${0} instead." }, - "footwear": { "type": "string", "const": "footwear", "errorMessage": "Material name should be 'footwear'. Found ${0} instead." }, - "top": { "type": "string", "const": "top", "errorMessage": "Material name should be 'top'. Found ${0} instead." } + "type": "object", + "properties": { + "bottom": { "type": "string", "const": "bottom", "errorMessage": "Material name should be 'bottom'. Found ${0} instead." }, + "footwear": { "type": "string", "const": "footwear", "errorMessage": "Material name should be 'footwear'. Found ${0} instead." }, + "top": { "type": "string", "const": "top", "errorMessage": "Material name should be 'top'. Found ${0} instead." } + } } } } diff --git a/schemas/meshNames.schema.json b/schemas/meshNames.schema.json index 4213247..90dec97 100644 --- a/schemas/meshNames.schema.json +++ b/schemas/meshNames.schema.json @@ -88,20 +88,23 @@ "errorMessage": "Mesh name should be one of 'Wolf3D_Body', 'Wolf3D_Outfit_Bottom', 'Wolf3D_Outfit_Footwear', 'Wolf3D_Outfit_Top'. Found ${0} instead." }, "nova": { - "bottom": { - "type": "string", - "const": "bottom", - "errorMessage": "Mesh name should be 'bottom'. Found ${0} instead." - }, - "footwear": { - "type": "string", - "const": "footwear", - "errorMessage": "Mesh name should be 'footwear'. Found ${0} instead." - }, - "top": { - "type": "string", - "const": "top", - "errorMessage": "Mesh name should be 'top'. Found ${0} instead." + "type": "object", + "properties": { + "bottom": { + "type": "string", + "const": "bottom", + "errorMessage": "Mesh name should be 'bottom'. Found ${0} instead." + }, + "footwear": { + "type": "string", + "const": "footwear", + "errorMessage": "Mesh name should be 'footwear'. Found ${0} instead." + }, + "top": { + "type": "string", + "const": "top", + "errorMessage": "Mesh name should be 'top'. Found ${0} instead." + } } } } diff --git a/schemas/meshTriangleCount.schema.json b/schemas/meshTriangleCount.schema.json index f08aa45..e30fb73 100644 --- a/schemas/meshTriangleCount.schema.json +++ b/schemas/meshTriangleCount.schema.json @@ -103,33 +103,36 @@ } }, "nova": { - "bottom": { - "type": "integer", - "minimum": 1, - "maximum": 6000, - "errorMessage": { - "minimum": "Too few triangles! This asset must have at least 1 triangle.", - "maximum": "Too many triangles! This asset must not have more than 6000 triangles. Found: ${0}." - } - }, - "top": { - "type": "integer", - "minimum": 1, - "maximum": 8000, - "errorMessage": { - "minimum": "Too few triangles! This asset must have at least 1 triangle.", - "maximum": "Too many triangles! This asset must not have more than 8000 triangles. Found: ${0}." - } - }, - "footwear": { - "type": "integer", - "minimum": 1, - "maximum": 4000, - "errorMessage": { - "minimum": "Too few triangles! This asset must have at least 1 triangle.", - "maximum": "Too many triangles! This asset must not have more than 4000 triangles. Found: ${0}." + "type": "object", + "properties": { + "bottom": { + "type": "integer", + "minimum": 1, + "maximum": 6000, + "errorMessage": { + "minimum": "Too few triangles! This asset must have at least 1 triangle.", + "maximum": "Too many triangles! This asset must not have more than 6000 triangles. Found: ${0}." + } + }, + "top": { + "type": "integer", + "minimum": 1, + "maximum": 8000, + "errorMessage": { + "minimum": "Too few triangles! This asset must have at least 1 triangle.", + "maximum": "Too many triangles! This asset must not have more than 8000 triangles. Found: ${0}." + } + }, + "footwear": { + "type": "integer", + "minimum": 1, + "maximum": 4000, + "errorMessage": { + "minimum": "Too few triangles! This asset must have at least 1 triangle.", + "maximum": "Too many triangles! This asset must not have more than 4000 triangles. Found: ${0}." + } } } } } -} \ No newline at end of file +}