public void AssetsTestError()
        {
            var model = new glTFAssets();

            //var json = model.ToJson();
            //Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
            //Debug.Log(json);
        }
Esempio n. 2
0
        public void AssetsTestError()
        {
            var model = new glTFAssets();

            //var json = model.ToJson();
            //Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
            //Debug.Log(json);

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var ex = Assert.Throws <JsonSchemaValidationException>(
                () => JsonSchema.FromType <glTFAssets>().Serialize(model, c)
                );

            Assert.AreEqual("[version.String] null", ex.Message);
        }
Esempio n. 3
0
        public void AssetsTest()
        {
            var model = new glTFAssets()
            {
                version = "0.49",
            };

            //var json = model.ToJson();
            //Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
            //Debug.Log(json);

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var json2 = JsonSchema.FromType <glTFAssets>().Serialize(model, c);

            Assert.AreEqual(@"{""version"":""0.49""}", json2);
        }
Esempio n. 4
0
        public static void Serialize_gltf_asset(JsonFormatter f, glTFAssets value)
        {
            f.BeginMap();


            if (!string.IsNullOrEmpty(value.generator))
            {
                f.Key("generator");
                f.Value(value.generator);
            }

            if (!string.IsNullOrEmpty(value.version))
            {
                f.Key("version");
                f.Value(value.version);
            }

            if (!string.IsNullOrEmpty(value.copyright))
            {
                f.Key("copyright");
                f.Value(value.copyright);
            }

            if (!string.IsNullOrEmpty(value.minVersion))
            {
                f.Key("minVersion");
                f.Value(value.minVersion);
            }

            if (value.extensions != null)
            {
                f.Key("extensions");
                value.extensions.Serialize(f);
            }

            if (value.extras != null)
            {
                f.Key("extras");
                value.extras.Serialize(f);
            }

            f.EndMap();
        }