Releases: dry-rb/dry-schema
v1.15.0
Changed
- Set mimimum Ruby version to 3.2 (@timriley)
- Support UUID v6, v7 and v8 predicates (
:uuid_v6?,:uuid_v7?and:uuid_v8?). (@illiatdesdindes in #509) - Support
size?,format?,true?andfalse?predicates when generating JSON schemas. (@cramt in #499) - Allow symbols to be given for
top_namespacesetting. (@unused in #491)
Fixed
-
Support intersection types (created with
&operator) in schema definitions. (@baweaver in #496)Now works without errors:
intersection_type = Types::Hash.schema(a: Types::String) & (Types::Hash.schema(b: Types::String) | Types::Hash.schema(c: Types::String)) schema = Dry::Schema.Params do required(:body).value(intersection_type) end schema.call(body: {a: "test", b: "value"}) # passes schema.call(body: {b: "value"}) # fails - missing 'a'
-
JSON schema generation now properly handles
Dry::Structinstances wrapped in constructors. (@baweaver in #497)Before, when generating JSON schema for a schema containing a Dry::Struct wrapped in a constructor (e.g.,
Address.constructor(&:itself)), all struct properties were omitted from the generated schema, returning only{type: "object"}instead of the full schema with properties.Before/after:
# Before: Missing struct properties Dry::Schema.Params do required(:address).value(Address.constructor(&:itself)) end.json_schema # => {:properties=>{:address=>{:type=>"object"}}} # No properties # After: Full struct schema included Dry::Schema.Params do required(:address).value(Address.constructor(&:itself)) end.json_schema # => {:properties=>{:address=>{:type=>"object", :properties=>{:street=>{...}}}}} # Properties included
-
JSON schema generation now correctly uses
minItems/maxItemsfor array size predicates instead ofminLength/maxLength. (@baweaver in #498) -
Show correct index in errors when validating unexpected keys in arrays. (@katafrakt in #510)
-
Support validating nested arrays when using
config.validate_keys = true. (@misdoro in #508) -
Fix handling of i18n messages from proc/lambda-produced hashes. (@rrothenberger in #493)
-
Fix error arising when generating errors when a key is repeated in a nested schema. (@jacob-carlborg in #503)
-
Fix method call typo in
Dry::Schema::Trace#respond_to_missing?. (@flash-gordon in 13ddb51)
v1.14.1
v1.14.0
Added
- Better support for sets in
excluded_from?andincluded_in?predicates (via #480) (@flash-gordon)
Fixed
- Fix info extension for maybe macro (via #484) (@flash-gordon + @santiagodoldan)
- Missing message for :uri? predicate (via #477) (@timjnh)
- JSON schema output for
maybe(:array)(via #463) (@tomgi)
Changed
- Set minimum Ruby version to 3.1 (@flash-gordon)
KeyValidatorworks faster for large schemas (via #461) (@radarek)
v1.13.4
v1.13.3
Fixed
- Fix struct extension for nested struct definitions (via #466) (@flash-gordon)
v1.13.2
v1.13.1
Fixed
- Support sum types of hashes (issue #446 fixed via #457) (@segiddins)
v1.13.0
Fixed
- Change required metadata back to true to fix regressions (issue #438 fixed via 439) (@robhanlon22)
- Compatibility with dry-configurable 1.0.1 (@flash-gordon)
- Warnings about using pattern matching on Ruby 2.7 (issue #441 fixed via #442) (@r7kamura)
- Make message cache fully thread-safe (via #440) (@mensfeld)
v1.12.0
Changed
- This version depends on dry-core 1.0 and dry-configurable 1.0 (@flash-gordon)