json_schema 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,7 @@ module Commands
40
40
  return false
41
41
  end
42
42
 
43
- if !(schema = @store.lookup_uri(schema_uri))
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.add_uri_reference(extra_schema.uri, extra_schema)
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 add_uri_reference(uri, schema)
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 lookup_uri(uri)
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.add_uri_reference(schema.uri, schema)
46
+ @store.add_schema(schema)
47
47
  else
48
- @local_store.add_uri_reference(schema.uri, schema)
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.lookup_uri(uri.to_s)
116
+ @store.lookup_schema(uri.to_s)
117
117
  else
118
- @local_store.lookup_uri(uri.to_s)
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.lookup_uri(uri.to_s)
157
+ if @store.lookup_schema(uri.to_s)
158
158
  resolve_uri(ref_schema, uri)
159
159
  else
160
160
  message =
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: