-
Notifications
You must be signed in to change notification settings - Fork 409
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 const
attribute to Schema
#3764
Comments
There is I don't think we should be assing |
That's probably the place where the discriminators are generated: tapir/docs/apispec-docs/src/main/scala/sttp/tapir/docs/apispec/schema/TSchemaToASchema.scala Line 171 in 628ec8e
|
I wonder if the way discriminators are defined for OpenAPI and AsyncAPI diverges? But hopefully we can generate something that works for both cases |
True, I think it is not being set anywhere in the schema generation code, though.
If I am not mistaken, currently OpenAPI and AsyncApi schemas are rendered in the same way, this leads to an illegal async api spec when using |
AsyncApi does not support |
Ah I see. Then I guess we'll need a flag for the |
What would be your suggestion for the flag? Discriminator-specific (we might stumble on other asyncapi/openapi incompatibilities in the future), or perhaps enum OpenApi/AsyncApi/JsonSchema? It seems that |
Let's start with a simple |
OK, let's roll with a |
Closining for now, see #3765. |
Both OpenAPI 3.1 and AsyncApi 3.0.0 support
const
:const
, as it conforms to JSON Schema Specification Draft 2020-12: https://json-schema.org/specification-links#2020-12const
: https://www.asyncapi.com/docs/reference/specification/v3.0.0More importantly, for AsynApi 3.0.0,
const
looks like the only working mechanism to encode union types with a discriminator - see https://www.asyncapi.com/docs/reference/specification/v3.0.0#models-with-polymorphism-support. (Current AsyncApi schema for union types rendered by tapir is invalid: #3754)The text was updated successfully, but these errors were encountered: