You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I send this schema to a Rust application to be deserialized by the Rust crate this will result in a jtd::SerdeSchema with a type that is Some("")and the enum set. If I then try to convert the jtd::SerdeSchema to a jtd::Schema this will fail since this is not allowed.
InvalidForm: invalid combination of keywords in schema
This would be solved by merging #5 but I wanted to add this issue to show a use case and a reason to why we would want to use omitempty.
This applies for at least Type, Discriminators and AdditionalProperties.
(The last one is a bit weird though, that should probably be fixed on the Rust side by ignoring false instead of using Optional<bool> but that's off topic for this issue)
The text was updated successfully, but these errors were encountered:
bombsimon
changed the title
Type on Schema should be nullable
Fields on Schema should be nullable
Mar 22, 2023
I don't find this statement in the RFC but given this error in the
jtd
Rust crate and the fact that aSchema
is anenum
and not astruct
on the Rust side you can't have bothType
andEnum
on a schema.Given I marshal the schema
jtd.Schema{Enum: []string{"foo", "bar"}
I will get the following output:If I send this schema to a Rust application to be deserialized by the Rust crate this will result in a
jtd::SerdeSchema
with atype
that isSome("")
and theenum
set. If I then try to convert thejtd::SerdeSchema
to ajtd::Schema
this will fail since this is not allowed.InvalidForm: invalid combination of keywords in schema
This would be solved by merging #5 but I wanted to add this issue to show a use case and a reason to why we would want to use
omitempty
.This applies for at least
Type
,Discriminators
andAdditionalProperties
.(The last one is a bit weird though, that should probably be fixed on the Rust side by ignoring
false
instead of usingOptional<bool>
but that's off topic for this issue)The text was updated successfully, but these errors were encountered: