jbuilder-schema 2.5.0 → 2.6.0
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 -5
- 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: ee4548cc207982dd75132d63f96e9396757af0b812b8649fb648cf978de0c4a7
|
4
|
+
data.tar.gz: fa0b95d49b9b0cb1cde94381bc0f217b08f89900d1b7f2bac72e9e3e2cd6ab41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d4fd3b56407c18a94877387f92f7c53f8632f0c610a7595bb567ec380454b72de0be3c68be5f17d9ece12dc78785aabb965a9a44d078b78b2d25e043c8b93c
|
7
|
+
data.tar.gz: 33ed871b094e1bb4103c7e07f4ab949ca9e595fa959433f449aed6e1f81a6b6f85d29da22b4185baee392a9385fdbd20035d0d8b045801844c9d1751675b371e
|
@@ -112,7 +112,13 @@ 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
|
+
_attributes.merge! type: :array, items: items
|
116
122
|
end
|
117
123
|
end
|
118
124
|
ensure
|
@@ -174,7 +180,7 @@ class Jbuilder::Schema
|
|
174
180
|
|
175
181
|
def _nullify_non_required_types(attributes, required)
|
176
182
|
attributes.transform_values! {
|
177
|
-
_1[:
|
183
|
+
_1[:nullable] = true unless required.include?(attributes.key(_1))
|
178
184
|
_1
|
179
185
|
}
|
180
186
|
end
|
@@ -191,7 +197,7 @@ class Jbuilder::Schema
|
|
191
197
|
if array
|
192
198
|
_attributes.merge! type: :array, items: ref
|
193
199
|
else
|
194
|
-
_attributes.merge!
|
200
|
+
_attributes.merge! allOf: [ref]
|
195
201
|
end
|
196
202
|
end
|
197
203
|
|
@@ -236,7 +242,7 @@ class Jbuilder::Schema
|
|
236
242
|
end
|
237
243
|
|
238
244
|
def _set_value(key, value)
|
239
|
-
value = _schema(key, value) unless value.is_a?(::Hash) && value.key?(:type)
|
245
|
+
value = _schema(key, value) unless value.is_a?(::Hash) && (value.key?(:type) || value.key?(:allOf)) # rubocop:disable Style/UnlessLogicalOperators
|
240
246
|
_set_description(key, value)
|
241
247
|
super
|
242
248
|
end
|
@@ -259,7 +265,8 @@ class Jbuilder::Schema
|
|
259
265
|
raise NullError.build(key) if current_value.nil?
|
260
266
|
|
261
267
|
value = _scope { yield self }
|
262
|
-
value = _object(value, _required!(value.keys)) unless value[:type] == :array || value.key?(
|
268
|
+
value = _object(value, _required!(value.keys)) unless value[:type] == :array || value.key?(:allOf)
|
269
|
+
|
263
270
|
_merge_values(current_value, value)
|
264
271
|
end
|
265
272
|
|
@@ -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.0"
|
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.0
|
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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jbuilder
|