-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an encoded discriminator value attribute for coproducts, use it to render const constraints #3955
Conversation
…o render const constraints
@@ -361,6 +361,16 @@ object Schema extends LowPrioritySchema with SchemaCompanionMacros { | |||
val Attribute: AttributeKey[Tuple] = new AttributeKey[Tuple]("sttp.tapir.Schema.Tuple") | |||
} | |||
|
|||
/** For coproduct schemas, when there's a discriminator field, used to attach the encoded value of the discriminator field. Such value is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coproduct may be also rendererd without a discriminator field (Json object nesting). We need to make sure this case is covered as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this applies only to discriminators. I think if there's no discriminator, then we don't have to do anything, that is we shouldn't add any constraints?
You can see how this is rendered in the OpenAPI yamls in the tests - let me know if that's what you were after |
Thank you, will do! |
@adamw thank you! I will test this with my setup |
Please take a look at test that illustrates issue with async api:
|
@zorba128 I've added your test, take a look |
An alternative approach to #3763
cc @kamilkloch @zorba128 @seveneves
Closes #3909