Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cast to ComposedSchema fails in case of OpenApi 3.1 with oneOf, anyOf, allOf #4657

Closed
quovide opened this issue Apr 16, 2024 · 0 comments · Fixed by #4698
Closed

Cast to ComposedSchema fails in case of OpenApi 3.1 with oneOf, anyOf, allOf #4657

quovide opened this issue Apr 16, 2024 · 0 comments · Fixed by #4698

Comments

@quovide
Copy link

quovide commented Apr 16, 2024

The cast to ComposedSchema here:

https://github.com/swagger-api/swagger-core/blob/95c8253c5239f6e980acd0b2998d037b35eb8761/modules/swagger-core/src/main/
java/io/swagger/v3/core/util/AnnotationsUtils.java#L827
https://github.com/swagger-api/swagger-core/blob/95c8253c5239f6e980acd0b2998d037b35eb8761/modules/swagger-core/src/main/
java/io/swagger/v3/core/util/AnnotationsUtils.java#L834
https://github.com/swagger-api/swagger-core/blob/95c8253c5239f6e980acd0b2998d037b35eb8761/modules/swagger-core/src/main/
java/io/swagger/v3/core/util/AnnotationsUtils.java#L841

image

Will cause a ClassCastException when generating OpenAPI 3.1
ComposedSchema is only created when OpenAPI is not 3.1.

See:

image

Removing the cast will resolve the issue. But I don't know this issue exists due to non compatibility with OpenAPI 3.1 or if it's a mere programming error.

The intended annotation use is:
@ApiResponse(responseCode = "200", description = "Get a foorter", content = @Content(schema = @Schema(anyOf = { Footer.class, Footer2.class }) Object getFooter();

Maybe this issue is related to #4634

zeldigas added a commit to zeldigas/swagger-core that referenced this issue Jun 13, 2024
Fixes swagger-api#4657

Extra: fixed yaml checks - yaml by default always uses \n separator
frantuma pushed a commit to zeldigas/swagger-core that referenced this issue Sep 23, 2024
Fixes swagger-api#4657

Extra: fixed yaml checks - yaml by default always uses \n separator
frantuma pushed a commit to zeldigas/swagger-core that referenced this issue Sep 23, 2024
Fixes swagger-api#4657

Extra: fixed yaml checks - yaml by default always uses \n separator
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant