Skip to content

Commit

Permalink
feat(nova): WIP custom validation rules for nova top, bottom, footwear
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjansenrpm committed Nov 29, 2024
1 parent 3761976 commit a054b80
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 58 deletions.
8 changes: 4 additions & 4 deletions schemas/assetBottom.nova.schema.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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.",
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions schemas/assetFootwear.nova.schema.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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.",
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions schemas/assetTop.nova.schema.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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.",
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions schemas/commonTexture.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/gltf-asset.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"required": ["bodyType"]
},
"than": {
"then": {
"allOf": [
{
"if": {
Expand Down
9 changes: 6 additions & 3 deletions schemas/materialNames.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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." }
}
}
}
}
31 changes: 17 additions & 14 deletions schemas/meshNames.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
}
}
Expand Down
55 changes: 29 additions & 26 deletions schemas/meshTriangleCount.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}."
}
}
}
}
}
}
}

0 comments on commit a054b80

Please sign in to comment.