-
Notifications
You must be signed in to change notification settings - Fork 77
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
discriminator field generated does not match asyncapi spec #160
Comments
I think this issue may be related with swagger-api/swagger-core#3411 Replacing |
is there a resolution or workaround for this case? |
just a question, which version of this library can work with swagger version 2, what will be the generated asyncAPI version? it will not be 2.6.0, right? |
I did a quick test with the new version in |
The change has been merged and will be part of the next release. If you want to try and verify it in your application, use the current Thank you for the reporting this discrepancy and motivating to switch to custom AsyncApi specific models. |
Springwolf 1.0.0 is out, which addresses this issue. Feel free to reopen in case you encounter any issues. |
Describe the bug
If an object has a polymorphic field when the json schema is generated for the object the discriminator property follows the openapi v3 convention (discriminator field is an object) whereas openapi spec wants the discriminator property as a string. This results in an invalid async api doc.
Dependencies and versions used
springwolf-kafka
version0.10.3
.spring-boot
version3.0.5
.Code example
This results in a Pet portion of the schema being:
note the
discriminator
field. For asyncapi spec this should just be:See https://www.asyncapi.com/docs/reference/specification/v2.0.0#schemaComposition.
I think this issue stems from the fact that the
SchemasService.getDefinitions()
returns back a map ofio.swagger.v3.oas.models.media.Schema
but really it should becom.asyncapi.v2.model.schema.Schema
. Given that the schemas are virtually identical i propose a some kind of translation service that maps from theio.swagger.v3.oas.models.media.Schema
to thecom.asyncapi.v2.model.schema.Schema
so that we handle cases of divergence between the 2 specs such as this oneStack trace and error logs
If an exception has been thrown or an error was logged by springwolf.
The text was updated successfully, but these errors were encountered: