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
So let me describe a use case I'm fairly sure is familiar.
I have bunch of data types. Some product types appear both in a sum type and alone. I prefer to use discriminators in sum types.
The way this typically works out is that you get two unrelated types in JSON Schema, where one has a 1 suffix, one of the two have the discriminator field, and they share the entire structure otherwise.
I'd like for this to be rendered as two types in JSON Schema:
Foo (without discriminator)
FooDisc (with discriminator)
Where FooDisc would be expressed using allOf in JSON Schema. This way the relationship would be clear, there would be less duplication.
I can try a PR myself, just wanted to check if it looks worthwhile first
The text was updated successfully, but these errors were encountered:
Interesting - definitely better than Foo and Foo1 schemas. I don't think we can add a new SchemaType implementation, though, as that would break binary compatibility I think? But maybe that's not needed - and it would be enough to add this logic at the tapir schema -> openapi schema translation stage? (in the TapirSchemaToJsonSchema class)
So let me describe a use case I'm fairly sure is familiar.
I have bunch of data types. Some product types appear both in a sum type and alone. I prefer to use discriminators in sum types.
The way this typically works out is that you get two unrelated types in JSON Schema, where one has a
1
suffix, one of the two have the discriminator field, and they share the entire structure otherwise.I'd like for this to be rendered as two types in JSON Schema:
Foo
(without discriminator)FooDisc
(with discriminator)Where
FooDisc
would be expressed usingallOf
in JSON Schema. This way the relationship would be clear, there would be less duplication.I can try a PR myself, just wanted to check if it looks worthwhile first
The text was updated successfully, but these errors were encountered: