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)