json-schema-generator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,6 +42,7 @@ module JSON
42
42
  buffer = StringIO.new
43
43
  buffer.puts "\"#{key}\": {"
44
44
  case value
45
+ when NilClass
45
46
  when TrueClass, FalseClass
46
47
  buffer.puts '"type": "boolean",'
47
48
  buffer.puts '"required": true'
@@ -86,7 +87,11 @@ module JSON
86
87
  buffer = StringIO.new
87
88
  buffer.puts '"type": "array",'
88
89
  buffer.puts '"required": true,'
89
- buffer.puts '"minItems": 1,'
90
+ if data.size == 0
91
+ buffer.puts '"minItems": 0,'
92
+ else
93
+ buffer.puts '"minItems": 1,'
94
+ end
90
95
  buffer.puts '"uniqueItems": true,'
91
96
  buffer.puts create_values("items", data.first)
92
97
 
@@ -1,5 +1,5 @@
1
1
  module JSON
2
2
  class SchemaGenerator
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-24 00:00:00.000000000 Z
12
+ date: 2013-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler