public void TestAddressSchemaLoad() { JSchema js = null; Assert.DoesNotThrow(() => js = JSchema.Parse(Schemas.AddressBaseSchema) ); Assert.AreEqual("Base.Address", js.Title); Assert.IsFalse(js.IsAtomicType()); }
public static string GetSchemaClrType(this JSchema schema) { if (schema.IsAtomicType()) { if (schema.Type == JSchemaType.Array) { if (schema.Items != null && schema.Items.Count == 1 && schema.Items[0] is JSchema) { var itemSchema = schema.Items[0] as JSchema; return("List<" + GetSchemaClrType(itemSchema) + ">"); } else { return("List<object>"); } } else { return(AtomicTypeNames[schema.Type.Value]); } } else { if (schema.Type == JSchemaType.Object && !string.IsNullOrEmpty(schema.Title)) { var cn = ClassNameFilters.ClassName(schema); if (!string.IsNullOrEmpty(cn)) { return(cn); } } return("object"); } }