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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa6cb1f2bc26111b92f3ad0f69607355098ce2b1
4
- data.tar.gz: 7ab3aa8ad52d3b24688e9bec601084054bc0dc2d
3
+ metadata.gz: 5443b3193c69650f360746aca96d9afdd9814653
4
+ data.tar.gz: 05bce66075b32b92c74a06014959ecfc3b63d2a9
5
5
  SHA512:
6
- metadata.gz: 839992a15fb2060fc7e21833baf9fb0b7cb0bd73cd571c70371bba5d25af025761ff96719cc335a13fea0c0164d620e1410f6cdac33b6967531a589acb77ac10
7
- data.tar.gz: c4755baa8fa4778ef7e9ac11b7240d9c2663f1cf6aa9f3c6bd914fa70f4e4c94f71268452e10b9fd100cf376f7e5d819946cb0ba0bfcc942337be29dd7d439f9
6
+ metadata.gz: 6151b7f2bbc774dcaf55bd1d1f105a7d503213c5562a9879c3cc0a957a202a1e3912204f65d56841bb5a0f9506521036bf1f59a7cfd1eb280050b7ce398b3e9c
7
+ data.tar.gz: 2255a70b8459fcf32ae602aa6c04237401e75cefdba8655294d8745f548317aca92a20502cb94b73ecdf48a8a97b70a8b9aa5977c87d3c83e7138dda4f77b346
@@ -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.9"
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.}
@@ -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'
@@ -19,6 +19,10 @@ user.json:
19
19
  properties:
20
20
  id:
21
21
  type: integer
22
+ admin:
23
+ type: integer
24
+ enum:
25
+ - 0
22
26
  avatar:
23
27
  type: string
24
28
  optional: true
@@ -13,6 +13,7 @@ describe JsonSchemaSpec do
13
13
 
14
14
  expect(response).to eq([{
15
15
  :id => response[0][:id],
16
+ :admin => 0,
16
17
  :name => "name",
17
18
  :company => {
18
19
  :name => "company:name"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh