json-schema 0.1.11 → 0.1.12

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.
Files changed (2) hide show
  1. data/lib/json-schema/validator.rb +11 -2
  2. metadata +4 -4
@@ -459,7 +459,9 @@ module JSON
459
459
  temp_uri = current_schema.uri.clone
460
460
  # Check for absolute path
461
461
  path = current_schema.schema['$ref'].split("#")[0]
462
- if path[0,1] == "/"
462
+ if path.nil? || path == ''
463
+ temp_uri.path = current_schema.uri.path
464
+ elsif path[0,1] == "/"
463
465
  temp_uri.path = Pathname.new(path).cleanpath.to_s
464
466
  else
465
467
  temp_uri.path = (Pathname.new(current_schema.uri.path).parent + path).cleanpath.to_s
@@ -509,9 +511,16 @@ module JSON
509
511
  uri = URI.parse(ref)
510
512
  if uri.relative?
511
513
  uri = parent_schema.uri.clone
514
+
512
515
  # Check for absolute path
513
516
  path = ref.split("#")[0]
514
- if path[0,1] == '/'
517
+
518
+ # This is a self reference and thus the schema does not need to be re-loaded
519
+ if path.nil? || path == ''
520
+ return
521
+ end
522
+
523
+ if path && path[0,1] == '/'
515
524
  uri.path = Pathname.new(path).cleanpath.to_s
516
525
  else
517
526
  uri.path = (Pathname.new(parent_schema.uri.path).parent + path).cleanpath.to_s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 11
10
- version: 0.1.11
9
+ - 12
10
+ version: 0.1.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kenny Hoxworth
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-21 00:00:00 -05:00
18
+ date: 2011-02-15 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
OSZAR »