json_schema 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,7 @@ module Commands
|
|
40
40
|
return false
|
41
41
|
end
|
42
42
|
|
43
|
-
if !(schema = @store.
|
43
|
+
if !(schema = @store.lookup_schema(schema_uri))
|
44
44
|
@errors = ["#{data_file}: Unknown $schema, try specifying one with -s."]
|
45
45
|
return false
|
46
46
|
end
|
@@ -66,7 +66,7 @@ module Commands
|
|
66
66
|
if !(extra_schema = parse(extra_schema))
|
67
67
|
return false
|
68
68
|
end
|
69
|
-
@store.
|
69
|
+
@store.add_schema(extra_schema)
|
70
70
|
end
|
71
71
|
true
|
72
72
|
end
|
@@ -10,16 +10,16 @@ module JsonSchema
|
|
10
10
|
@schema_map = {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
raise "can't add nil URI" if uri.nil?
|
15
|
-
@schema_map[uri] = schema
|
13
|
+
def add_schema(schema)
|
14
|
+
raise "can't add nil URI" if schema.uri.nil?
|
15
|
+
@schema_map[schema.uri] = schema
|
16
16
|
end
|
17
17
|
|
18
18
|
def each
|
19
19
|
@schema_map.each { |k, v| yield(k, v) }
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def lookup_schema(uri)
|
23
23
|
@schema_map[uri]
|
24
24
|
end
|
25
25
|
end
|
@@ -43,9 +43,9 @@ module JsonSchema
|
|
43
43
|
def add_reference(schema)
|
44
44
|
uri = URI.parse(schema.uri)
|
45
45
|
if uri.absolute?
|
46
|
-
@store.
|
46
|
+
@store.add_schema(schema)
|
47
47
|
else
|
48
|
-
@local_store.
|
48
|
+
@local_store.add_schema(schema)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -113,9 +113,9 @@ module JsonSchema
|
|
113
113
|
|
114
114
|
def lookup_reference(uri)
|
115
115
|
if uri.absolute?
|
116
|
-
@store.
|
116
|
+
@store.lookup_schema(uri.to_s)
|
117
117
|
else
|
118
|
-
@local_store.
|
118
|
+
@local_store.lookup_schema(uri.to_s)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
@@ -154,7 +154,7 @@ module JsonSchema
|
|
154
154
|
scheme = uri.scheme || "http"
|
155
155
|
# allow resolution if something we've already parsed has claimed the
|
156
156
|
# full URL
|
157
|
-
if @store.
|
157
|
+
if @store.lookup_schema(uri.to_s)
|
158
158
|
resolve_uri(ref_schema, uri)
|
159
159
|
else
|
160
160
|
message =
|