diff --git a/Assets/VRM/UniGLTF/Editor/UniGLTFTests.cs b/Assets/VRM/UniGLTF/Editor/UniGLTFTests.cs index a2b9de381..b9d567742 100644 --- a/Assets/VRM/UniGLTF/Editor/UniGLTFTests.cs +++ b/Assets/VRM/UniGLTF/Editor/UniGLTFTests.cs @@ -575,6 +575,26 @@ namespace UniGLTF Assert.AreEqual("[version.String] null", ex.Message); } + [Test] + public void GLTFTest() + { + var model = new glTF() + { + asset = new glTFAssets() + { + version = "0.49", + }, + extensions = null, + }; + + var c = new JsonSchemaValidationContext("") + { + EnableDiagnosisForNotRequiredFields = true, + }; + var json2 = JsonSchema.FromType().Serialize(model, c); + Assert.AreEqual(@"{""asset"":{""version"":""0.49""},""extras"":{}}", json2); + } + [Test] public void SameMeshButDifferentMaterialExport() { diff --git a/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs b/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs index 7df4bd651..17252adbb 100644 --- a/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs +++ b/Assets/VRM/UniGLTF/Scripts/Format/glTF.cs @@ -31,7 +31,7 @@ namespace UniGLTF public glTFAssets asset = new glTFAssets(); #region Buffer - [JsonSchema(MinItems = 1)] + [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)] public List buffers = new List(); public int AddBuffer(IBytesBuffer bytesBuffer) { @@ -40,7 +40,7 @@ namespace UniGLTF return index; } - [JsonSchema(MinItems = 1)] + [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)] public List bufferViews = new List(); public int AddBufferView(glTFBufferView view) { @@ -49,7 +49,7 @@ namespace UniGLTF return index; } - [JsonSchema(MinItems = 1)] + [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)] public List accessors = new List(); T[] GetAttrib(glTFAccessor accessor, glTFBufferView view) where T : struct @@ -212,7 +212,7 @@ namespace UniGLTF return samplers[index]; } - [JsonSchema(MinItems = 1)] + [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)] public List images = new List(); public int GetImageIndexFromTextureIndex(int textureIndex)