json-schema-serializer 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/json/schema/serializer.rb +2 -2
- data/lib/json/schema/serializer/version.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: d6ac2c2fbbc49625b87c22bba8061ef8aacff924a4e1bfa19faedbeeb3d6fcb7
|
4
|
+
data.tar.gz: 4071e3b87030dc4bff3f5800a650618619b703121094afea5b9cae8b1f584689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5372d62cecbea2832b93c09b4c3c7336a54d52e342f23d7c8689266d2b848d94ffb218cb19464ba16d74464da6ccc69c4706127f85acfa383f24cbb209d9cf0
|
7
|
+
data.tar.gz: 5426726b5f922839c4e21b0172a1f9281167bc2c5f41ef18baa81995d2395949624627f6b786f2c764715fabef7ba299f21d316a40d4b456543755b9b68eb3e3
|
data/README.md
CHANGED
@@ -185,7 +185,7 @@ options
|
|
185
185
|
|
186
186
|
schema object `$ref` resolver
|
187
187
|
|
188
|
-
#### options[:
|
188
|
+
#### options[:schema_key_transform_for_input] [Proc]
|
189
189
|
|
190
190
|
input key transform
|
191
191
|
|
@@ -195,10 +195,10 @@ new({
|
|
195
195
|
properties: {
|
196
196
|
userCount: { type: :integer },
|
197
197
|
},
|
198
|
-
}, {
|
198
|
+
}, { schema_key_transform_for_input: ->(name) { name.underscore } }).serialize({ user_count: 1 }) == { "userCount" => 1 }
|
199
199
|
```
|
200
200
|
|
201
|
-
#### options[:
|
201
|
+
#### options[:schema_key_transform_for_output] [Proc]
|
202
202
|
|
203
203
|
output key transform
|
204
204
|
|
@@ -208,7 +208,7 @@ new({
|
|
208
208
|
properties: {
|
209
209
|
userCount: { type: :integer },
|
210
210
|
},
|
211
|
-
}, {
|
211
|
+
}, { schema_key_transform_for_output: ->(name) { name.underscore } }).serialize({ userCount: 1 }) == { "user_count" => 1 }
|
212
212
|
```
|
213
213
|
|
214
214
|
#### options[:injectors] [Hashlike<String, Class>, Class], options[:inject_key] [String, Symbol]
|
@@ -189,8 +189,8 @@ module JSON
|
|
189
189
|
properties_schema = try_hash(schema, :properties)
|
190
190
|
additional_properties_schema = try_hash(schema, :additionalProperties)
|
191
191
|
required_schema = Set.new(try_hash(schema, :required)&.map(&:to_s))
|
192
|
-
input_key_transform = options[:
|
193
|
-
output_key_transform = options[:
|
192
|
+
input_key_transform = options[:schema_key_transform_for_input] # schema key -> input obj key
|
193
|
+
output_key_transform = options[:schema_key_transform_for_output] # schema key -> out
|
194
194
|
ret =
|
195
195
|
properties_schema.map do |name, property_schema|
|
196
196
|
input_key = input_key_transform ? input_key_transform.call(name.to_s) : name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-schema-serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
@@ -181,7 +181,7 @@ metadata:
|
|
181
181
|
homepage_uri: https://github.com/Narazaka/json-schema-serializer
|
182
182
|
source_code_uri: https://github.com/Narazaka/json-schema-serializer.git
|
183
183
|
changelog_uri: https://github.com/Narazaka/json-schema-serializer/blob/master/CHANGELOG.md
|
184
|
-
documentation_uri: https://www.rubydoc.info/gems/json-schema-serializer/1.5.
|
184
|
+
documentation_uri: https://www.rubydoc.info/gems/json-schema-serializer/1.5.2
|
185
185
|
post_install_message:
|
186
186
|
rdoc_options: []
|
187
187
|
require_paths:
|