json-schema_builder 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db809adc8a2ac574e1b54b042b62282ecda19423
4
- data.tar.gz: 6c41e21a44a2e6d9d1fc67a470f1351469d28733
3
+ metadata.gz: b5622c90ccc77b1f1cd3a82cc00bc5e71148066d
4
+ data.tar.gz: 653277077d4702417a8c514c7d1d786adbed441e
5
5
  SHA512:
6
- metadata.gz: e863c5b0f63c05b29197583e1db2039de5cb62265ab69e75e62e7bfa95df0dfdf1c0dd9f24812b2170c43dcdff404e69b8f1e192960c6bce424d49adbfef5057
7
- data.tar.gz: 01801525f6be2c93ef0be474b65ba5f9b9e8d3552de90bf293a7085608d1f2db3d26fcc10e72f90b1d25b923819ba88ab09fa05afd0a49e75d16089dc24571c6
6
+ metadata.gz: 618acabf362677ae7c5a9e48d9b5e3620202d1fd9b882ac37ac13bbc3c4681ad60d4ec179a058a929898c93c59978556f6e86997ffa75a3939f18e01141a1eeb
7
+ data.tar.gz: 86e142da2b0b678cff3f7df945bb848c16b31ae7766eeeb65ad2df01cd31048eac43c2498e0979c632e7c85a80cc156fe8a2365260e50a7b8e56a85d7a23a86b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json-schema_builder (0.0.6)
4
+ json-schema_builder (0.0.7)
5
5
  activesupport (~> 4.0)
6
6
  json-schema (~> 2.5)
7
7
 
@@ -6,6 +6,23 @@ module JSON
6
6
  let(:schema_context){ { } }
7
7
  let(:schema){ described_class.new(schema_context).send schema_method }
8
8
  let(:json){ schema.as_json }
9
+ let(:id_schema) do
10
+ {
11
+ oneOf: [
12
+ { type: 'integer', minimum: 1 },
13
+ { type: 'string', pattern: '^[1-9]\d*$' }
14
+ ]
15
+ }
16
+ end
17
+ let(:nullable_id_schema) do
18
+ {
19
+ oneOf: [
20
+ { type: 'integer', minimum: 1 },
21
+ { type: 'string', pattern: '^[1-9]\d*$' },
22
+ { type: 'null' }
23
+ ]
24
+ }
25
+ end
9
26
  subject{ DeepOpenStruct.new json }
10
27
 
11
28
  def self.included(klass)
@@ -1,5 +1,5 @@
1
1
  module JSON
2
2
  module SchemaBuilder
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
  end
5
5
  end
@@ -1,6 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Examples::Ids, type: :integration do
4
+ include JSON::SchemaBuilder::RSpecHelper
5
+ let(:schema_method){ :example }
6
+
4
7
  it_behaves_like 'a builder' do
5
8
  let(:expected_json) do
6
9
  {
@@ -19,7 +22,9 @@ RSpec.describe Examples::Ids, type: :integration do
19
22
  { type: 'string', pattern: '^[1-9]\d*$' },
20
23
  { type: 'null' }
21
24
  ]
22
- }
25
+ },
26
+ an_id: id_schema,
27
+ a_nullable_id: nullable_id_schema
23
28
  }
24
29
  }
25
30
  end
@@ -6,6 +6,8 @@ module Examples
6
6
  object do
7
7
  id :user_id, required: true
8
8
  id :optional_id, null: true
9
+ id :an_id
10
+ id :a_nullable_id, null: true
9
11
  end
10
12
  end
11
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish