-
-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Labels
Description
Describe the bug
When generating the json schema for a schema which has a Dry::Struct wrapped in a Constructor all the fields from the struct is ommited from the schema
To Reproduce
module Model
class Address < Model::Base
attribute :street, Types::Strict::String.optional.default(nil)
end
end
module Types
include Dry.Types()
end
Dry::Schema.Params do required(:_).value(Model::Address.constructor(&:itself)) end.json_schema
# {:$schema=>"http://json-schema.org/draft-06/schema#", :type=>"object", :properties=>{:_=>{:type=>"object"}}, :required=>["_"]}
Dry::Schema.Params do required(:_).value(Model::Address.schema.constructor(&:itself)) end.json_schema
# {:$schema=>"http://json-schema.org/draft-06/schema#",
# :type=>"object",
# :properties=>{:_=>{:type=>"object", :properties=>{:street=>{:type=>"string"}}, :required=>["street"]}},
# :required=>["_"]}
Expected behavior
Both of the last 2 statements to return the same, i shouldnt have to refer to the inner schema of the struct
My environment
- Affects my production application: only my autogenerated docs
- Ruby version: 3.3.9
- OS: nixos