json_schema 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e99a8e1142fc7a9629bb3c8af18b4f257b85e278
4
- data.tar.gz: 7f6d730a5d32c5326b79c69e1184e893aa03a890
3
+ metadata.gz: c09e98d77f8312b241a686e9754c64868f3168cd
4
+ data.tar.gz: 37c8aa03c7b3c20f1297521e1ad028450ef1dbe9
5
5
  SHA512:
6
- metadata.gz: 575c4b1b0d0b59315128b01bf6659aa4619276686747389623bcc28f917579f409c46662d14c940aa3ef6561f0abe03dcd6a713817e35fa5da280ce92a82f38b
7
- data.tar.gz: 99eea0dd8d3d826ff55d2dae235aacebebaba6a03486dd7f9b4368f752a55f3a632e8fb2dd783a54aeb072295d46b20d410bccbe279ccff267584fb8fd13081d
6
+ metadata.gz: c4eaccae952cb463de80492d3e5903e0f597dfed795ccdd2929c253ba4efd27a4b97b07527f6eef6b9f4ba3a0c943ab6c305ada987586f4d52c9a47d8adfb9b4
7
+ data.tar.gz: c126e71608055b4747d7556548a268021ba388fbccf77893408e5b6e166d9c9d53ca25a1e4da4a78416a4893f6797bf81a56c73795097302a776528679cae2ca
@@ -41,7 +41,6 @@ module Commands
41
41
  end
42
42
 
43
43
  if !(schema = @store.lookup_schema(schema_uri))
44
- puts schema_uri
45
44
  @errors = ["#{data_file}: Unknown $schema, try specifying one with -s."]
46
45
  return false
47
46
  end
@@ -175,6 +175,7 @@ module JsonSchema
175
175
  link.method = l["method"] ? l["method"].downcase.to_sym : nil
176
176
  link.rel = l["rel"]
177
177
  link.title = l["title"]
178
+ link.media_type = l["mediaType"]
178
179
 
179
180
  if l["schema"]
180
181
  link.schema = parse_data(l["schema"], schema, "links/#{i}/schema")
@@ -261,14 +261,6 @@ module JsonSchema
261
261
  !clones.include?(self)
262
262
  end
263
263
 
264
- def depth
265
- if parent
266
- parent.depth + 1
267
- else
268
- 0
269
- end
270
- end
271
-
272
264
  def pointer
273
265
  if parent
274
266
  parent.pointer + "/" + fragment
@@ -297,6 +289,7 @@ module JsonSchema
297
289
  attr_accessor :href
298
290
  attr_accessor :method
299
291
  attr_accessor :rel
292
+ attr_accessor :media_type
300
293
  attr_accessor :schema
301
294
  attr_accessor :target_schema
302
295
  attr_accessor :title
@@ -304,6 +297,10 @@ module JsonSchema
304
297
  def enc_type
305
298
  @enc_type || "application/json"
306
299
  end
300
+
301
+ def media_type
302
+ @media_type || "application/json"
303
+ end
307
304
  end
308
305
 
309
306
  # Media type subobject for a hyperschema.
@@ -30,8 +30,7 @@ module JsonSchema
30
30
  end
31
31
 
32
32
  def to_s
33
- uri = schema.uri || ""
34
- "#{pointer}: failed schema #{uri}#{schema.pointer}: #{message}"
33
+ "#{pointer}: failed schema #{schema.pointer}: #{message}"
35
34
  end
36
35
  end
37
36
  end
@@ -160,6 +160,7 @@ describe JsonSchema::Parser do
160
160
  "href" => "/apps",
161
161
  "method" => "POST",
162
162
  "rel" => "create",
163
+ "mediaType" => "application/json",
163
164
  "schema" => {
164
165
  "properties" => {
165
166
  "name" => {
@@ -180,6 +181,7 @@ describe JsonSchema::Parser do
180
181
  assert_equal "/apps", link.href
181
182
  assert_equal :post, link.method
182
183
  assert_equal "create", link.rel
184
+ assert_equal "application/json", link.media_type
183
185
  assert_equal "#/definitions/app/definitions/name",
184
186
  link.schema.properties["name"].reference.pointer
185
187
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2014-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest