コード例 #1
0
 private JSchemaResolver GetJSchemaResolver()
 {
     return(new FileSystemYamlJSchemaResolver(RootData)
     {
         JSchemaLoader = JSchemaLoader.ForFormat(SerializationFormat.Yaml)
     });
 }
コード例 #2
0
        private JSchema GetJSchema(string dataPath, out JSchemaClassManager jSchemaClassManager)
        {
            JSchema jSchema = JSchemaLoader.LoadYamlJSchema(dataPath);

            jSchemaClassManager = GetJSchemaManager();
            return(jSchema);
        }
コード例 #3
0
        public void CanGetRootClassName()
        {
            // check @type
            // check title
            // check javaType
            // check _tableNameProperties
            JSchema             jSchema      = JSchemaLoader.LoadYamlJSchema(OrganizationDataPath);
            JSchemaClassManager classManager = new JSchemaClassManager("@type", "title", "javaType");
            JSchemaClass        orgClass     = classManager.LoadJSchemaClassFile(OrganizationDataPath);
            string className = orgClass.ClassName;

            Expect.IsNotNullOrEmpty(className);
            Expect.AreEqual("Organization", className);
        }
コード例 #4
0
        public void CanGetPropertyNames()
        {
            JSchema             jSchema             = JSchemaLoader.LoadYamlJSchema(OrganizationDataPath);
            JSchemaClassManager jSchemaClassManager = new JSchemaClassManager("@type", "title", "javaType");
            JSchemaClass        jSchemaClass        = jSchemaClassManager.LoadJSchemaClassFile(OrganizationDataPath);

            string[]         propertyNames       = jSchemaClass.Properties.Select(p => p.PropertyName).ToArray();
            HashSet <string> propertyNameHashSet = new HashSet <string>(propertyNames);

            propertyNameHashSet.Contains("FriendlyId").IsTrue("FriendlyId not found");
            propertyNameHashSet.Contains("WebsiteUrl").IsTrue("WebsiteUrl not found");

            propertyNameHashSet.Contains("BusinessName").IsTrue("BusinessName not found");
            propertyNameHashSet.Contains("TaxIds").IsTrue("TaxIds");
            propertyNameHashSet.Contains("IndustryCodes").IsTrue("IndustryCodes");
        }
コード例 #5
0
        public void CanLoadJSchemaWithoutExceptions()
        {
            JSchema jSchema = JSchemaLoader.LoadJSchema(OrganizationDataPath, SerializationFormat.Yaml);

            OutLine(jSchema.ToString(), ConsoleColor.Cyan);
        }