示例#1
0
        public JsonSchema Load()
        {
            JsonObject root = document.Root.As<JsonObject>();
            JsonSchemaRepository repository = new JsonSchemaRepository();

            JsonSchemaDefinitions definitions = new JsonSchemaDefinitions(repository, root);
            JsonSchema schema = new JsonSchema(parser.Parse(root), definitions);

            return schema;
        }
示例#2
0
        public JsonSchema Resolve(string reference)
        {
            if (reference.StartsWith("#"))
            {
                string[] parts = reference.Split('/');
                JsonObject node = FindNode(parts);

                JsonSchemaRule rule = parser.Parse(node);
                JsonSchema schema = new JsonSchema(rule, this);

                return schema;
            }

            return repository.GetByReference(reference);
        }
示例#3
0
 public OmletSchemaBuilder OnResponse(HttpStatusCode status, JsonSchema schema)
 {
     onResponse[status] = schema;
     return this;
 }
示例#4
0
 public OmletSchemaBuilder OnRequest(JsonSchema schema)
 {
     onRequest = schema;
     return this;
 }
示例#5
0
文件: JsonSchema.cs 项目: amacal/jinx
 static JsonSchema()
 {
     Draft04 = GetSchema("draft-04");
 }