json-schema_builder 0.0.6 → 0.0.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5622c90ccc77b1f1cd3a82cc00bc5e71148066d
|
4
|
+
data.tar.gz: 653277077d4702417a8c514c7d1d786adbed441e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 618acabf362677ae7c5a9e48d9b5e3620202d1fd9b882ac37ac13bbc3c4681ad60d4ec179a058a929898c93c59978556f6e86997ffa75a3939f18e01141a1eeb
|
7
|
+
data.tar.gz: 86e142da2b0b678cff3f7df945bb848c16b31ae7766eeeb65ad2df01cd31048eac43c2498e0979c632e7c85a80cc156fe8a2365260e50a7b8e56a85d7a23a86b
|
data/Gemfile.lock
CHANGED
@@ -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,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
|