jbuilder-schema 2.5.0 → 2.6.1
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 +4 -4
- data/lib/jbuilder/schema/template.rb +12 -4
- data/lib/jbuilder/schema/version.rb +1 -1
- data/lib/jbuilder/schema.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3739c249efa5efeb070fb651dc9ae83cd6421078272997b34be154c5680a24a9
|
4
|
+
data.tar.gz: 18523b00d2de89fcf36dcb9306826985dad2d9bc72845cdf5c53a74536978bc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24128255cc7873cdf4929ab24bd9f46819fe673cc5bf9c9a2cd9ec161e0a02b8910cb136d6e5410dd8fc9826679dd52d5a7f77ef99111a529bbe428bcc1c8361
|
7
|
+
data.tar.gz: 886edbbc3c763fea1fd312bb682b43884d8d8036d0de74245cef418bae81bbd1954c1efa28bfcaaff7c6a5c2a9d754fd5c9bc5f28dc004f945f9af7212f5eb95
|
@@ -112,7 +112,14 @@ class Jbuilder::Schema
|
|
112
112
|
@within_block = _within_block?(&block)
|
113
113
|
|
114
114
|
_with_schema_overrides(schema) do
|
115
|
-
|
115
|
+
# TODO: Find a better solution
|
116
|
+
# Here we basically remove allOf key from items, because it's redundant, although valid.
|
117
|
+
# Better would be not to set it if it's not needed, but I couldn't figure how,
|
118
|
+
# as we have array of separate object partials hare, so each one of them would legally have allOf key.
|
119
|
+
items = _scope { super(collection, *args, &block) }
|
120
|
+
items = items[:allOf].first if items.key?(:allOf)
|
121
|
+
items = _object(items, _required!(items.keys)) unless items.key?(:$ref) || items.key?(:object)
|
122
|
+
_attributes.merge! type: :array, items: items
|
116
123
|
end
|
117
124
|
end
|
118
125
|
ensure
|
@@ -191,7 +198,7 @@ class Jbuilder::Schema
|
|
191
198
|
if array
|
192
199
|
_attributes.merge! type: :array, items: ref
|
193
200
|
else
|
194
|
-
_attributes.merge!
|
201
|
+
_attributes.merge! allOf: [ref]
|
195
202
|
end
|
196
203
|
end
|
197
204
|
|
@@ -236,7 +243,7 @@ class Jbuilder::Schema
|
|
236
243
|
end
|
237
244
|
|
238
245
|
def _set_value(key, value)
|
239
|
-
value = _schema(key, value) unless value.is_a?(::Hash) && value.key?(:type)
|
246
|
+
value = _schema(key, value) unless value.is_a?(::Hash) && (value.key?(:type) || value.key?(:allOf)) # rubocop:disable Style/UnlessLogicalOperators
|
240
247
|
_set_description(key, value)
|
241
248
|
super
|
242
249
|
end
|
@@ -259,7 +266,8 @@ class Jbuilder::Schema
|
|
259
266
|
raise NullError.build(key) if current_value.nil?
|
260
267
|
|
261
268
|
value = _scope { yield self }
|
262
|
-
value = _object(value, _required!(value.keys)) unless value[:type] == :array || value.key?(
|
269
|
+
value = _object(value, _required!(value.keys)) unless value[:type] == :array || value.key?(:allOf)
|
270
|
+
|
263
271
|
_merge_values(current_value, value)
|
264
272
|
end
|
265
273
|
|
@@ -1,4 +1,4 @@
|
|
1
1
|
# We can't use the standard `Jbuilder::Schema::VERSION =` because
|
2
2
|
# `Jbuilder` isn't a regular module namespace, but a class …which also loads Active Support.
|
3
3
|
# So we use trickery, and assign the proper version once `jbuilder/schema.rb` is loaded.
|
4
|
-
JBUILDER_SCHEMA_VERSION = "2.
|
4
|
+
JBUILDER_SCHEMA_VERSION = "2.6.1"
|
data/lib/jbuilder/schema.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jbuilder-schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Sidorov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jbuilder
|