committee 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,8 +48,10 @@ module Committee
48
48
  else
49
49
  definition = @schema.find(value["$ref"])
50
50
  check_type!(definition["type"], data[key], path + [key])
51
- check_format!(definition["format"], data[key], path + [key])
52
- check_pattern!(definition["pattern"], data[key], path + [key])
51
+ unless definition["type"].include?("null") && data[key].nil?
52
+ check_format!(definition["format"], data[key], path + [key])
53
+ check_pattern!(definition["pattern"], data[key], path + [key])
54
+ end
53
55
  end
54
56
  end
55
57
  end
@@ -115,8 +117,13 @@ module Committee
115
117
  def build_schema_keys
116
118
  keys = []
117
119
  @type_schema["properties"].each do |key, info|
118
- if info["properties"]
119
- keys += info["properties"].keys.map { |k| "#{key}:#{k}" }
120
+ data = if info["properties"]
121
+ info
122
+ elsif info["$ref"]
123
+ @schema.find(info["$ref"])
124
+ end
125
+ if data["properties"]
126
+ keys += data["properties"].keys.map { |k| "#{key}:#{k}" }
120
127
  else
121
128
  keys << key
122
129
  end
@@ -27,9 +27,9 @@ module Committee
27
27
  type_schema["links"].each do |link|
28
28
  routes[link["method"]] ||= []
29
29
  # /apps/{id} --> /apps/([^/]+)
30
- pattern = link["href"].gsub(/\{(.*?)\}/, "[^/]+")
30
+ href = link["href"].gsub(/\{(.*?)\}/, "[^/]+")
31
31
  routes[link["method"]] <<
32
- [Regexp.new(pattern), link, type_schema]
32
+ [%r{^#{href}$}, link, type_schema]
33
33
  end
34
34
  end
35
35
  routes
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: committee
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brandur
9
+ - geemus (Wesley Beary)
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-12-18 00:00:00.000000000 Z
13
+ date: 2014-01-13 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: multi_json
@@ -92,7 +93,9 @@ dependencies:
92
93
  - !ruby/object:Gem::Version
93
94
  version: '0'
94
95
  description:
95
- email: brandur@mutelight.org
96
+ email:
97
+ - brandur@mutelight.org
98
+ - geemus+github@gmail.com
96
99
  executables:
97
100
  - committee-stub
98
101
  extensions: []
@@ -142,8 +145,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
145
  version: '0'
143
146
  requirements: []
144
147
  rubyforge_project:
145
- rubygems_version: 1.8.24
148
+ rubygems_version: 1.8.23
146
149
  signing_key:
147
150
  specification_version: 3
148
151
  summary: A collection of middleware to support JSON Schema.
149
152
  test_files: []
153
+ has_rdoc: