json_schema_spec 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/json_schema_spec.gemspec +1 -1
- data/lib/json_schema_spec.rb +2 -0
- data/spec/fixtures/schema.yml +4 -0
- data/spec/json_schema_spec_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5443b3193c69650f360746aca96d9afdd9814653
|
4
|
+
data.tar.gz: 05bce66075b32b92c74a06014959ecfc3b63d2a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6151b7f2bbc774dcaf55bd1d1f105a7d503213c5562a9879c3cc0a957a202a1e3912204f65d56841bb5a0f9506521036bf1f59a7cfd1eb280050b7ce398b3e9c
|
7
|
+
data.tar.gz: 2255a70b8459fcf32ae602aa6c04237401e75cefdba8655294d8745f548317aca92a20502cb94b73ecdf48a8a97b70a8b9aa5977c87d3c83e7138dda4f77b346
|
data/json_schema_spec.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "json_schema_spec"
|
7
|
-
spec.version = "0.0
|
7
|
+
spec.version = "0.1.0"
|
8
8
|
spec.authors = ["Winton Welsh"]
|
9
9
|
spec.email = ["mail@wintoni.us"]
|
10
10
|
spec.description = %q{Generate fixtures from JSON schemas.}
|
data/lib/json_schema_spec.rb
CHANGED
@@ -54,6 +54,8 @@ module JsonSchemaSpec
|
|
54
54
|
def json_schema_value(key, value, prefix)
|
55
55
|
if !value.is_a?(Hash) || value[:optional] || value[:type] == 'null'
|
56
56
|
nil
|
57
|
+
elsif value[:enum]
|
58
|
+
value[:enum].shuffle.first
|
57
59
|
elsif value[:type] == 'array'
|
58
60
|
[ json_schema_value(key, value[:items], prefix) ]
|
59
61
|
elsif value[:type] == 'boolean'
|
data/spec/fixtures/schema.yml
CHANGED