Closed xronos-i-am closed 2 years ago
What if you do:
schema = Dry::Schema.Params do
required(:personal_info).hash do
required(:email).filled(:string, format?: /@/)
end
end
??
schema = Dry::Schema.Params do required(:personal_info).hash do required(:email).filled(:string, format?: /@/) end end
Nothing changed, same error
What if you remove the format?
part?
What if you remove the
format?
part?
It works
{:$schema=>"http://json-schema.org/draft-06/schema#",
:type=>"object",
:properties=>
{:personal_info=>
{:type=>"object",
:properties=>{:email=>{:type=>"string", :minLength=>1}},
:required=>["email"]}},
:required=>["personal_info"]}
Yeah so it's just that there's no support for format?
predicate yet.
not quite, the following works too:
schema = Dry::Schema.Params do
required(:email).filled(:string, format?: /@/)
end
{:$schema=>"http://json-schema.org/draft-06/schema#",
:type=>"object",
:properties=>{:email=>{:type=>"string", :minLength=>1}},
:required=>["email"]}
so, the problem is nesting
Describe the bug
In "loose" mode JSON schema should be generated. The following code throws
Dry::Schema::JSONSchema::SchemaCompiler::UnknownConversionError
insteadTo Reproduce
Expected behavior
A valid JSON schema
My environment