lib/schemacop/v3/hash_node.rb in schemacop-3.0.16 vs lib/schemacop/v3/hash_node.rb in schemacop-3.0.17
- old
+ new
@@ -53,11 +53,11 @@
properties[name] = property
end
end
json = {}
- json[:properties] = Hash[properties.values.map { |p| [p.name, p.as_json] }] if properties.any?
- json[:patternProperties] = Hash[pattern_properties.values.map { |p| [V3.sanitize_exp(p.name), p.as_json] }] if pattern_properties.any?
+ json[:properties] = properties.values.map { |p| [p.name, p.as_json] }.to_h if properties.any?
+ json[:patternProperties] = pattern_properties.values.map { |p| [V3.sanitize_exp(p.name), p.as_json] }.to_h if pattern_properties.any?
# In schemacop, by default, additional properties are not allowed,
# the users explicitly need to enable additional properties
if options[:additional_properties].is_a?(TrueClass)
json[:additionalProperties] = true