Skip to content
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

NPE thrown in AnnotationUtils due to "API backwards compatibility fix" introduced in 2.2.21 #4645

Closed
joloto opened this issue Apr 4, 2024 · 4 comments
Assignees

Comments

@joloto
Copy link

joloto commented Apr 4, 2024

Changes introduced for this issue #4196 introduce NullPointerException due to 'API backwards compatibility' fix in which null is passed to the modified method.

The changes were introduced in this PR: #4608

image

This results in NPE on line 1387 of AnnotationUtils due to null components:
image

https://github.com/swagger-api/swagger-core/blob/d5c37284f5dbb9b6e65858c25d55c1aa2969f8a2/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java#L1387C58-L1387C58

(I experienced this issue when upgrading springdoc-openapi from 2.4.0 -> v2.5.0, which includes upgrade to swagger-core 2.2.21, which it seems is in fact not backwards compatible!)

@frantuma frantuma self-assigned this Apr 5, 2024
@frantuma
Copy link
Member

frantuma commented Apr 5, 2024

Thanks for reporting this. Can you please share the stack trace and ideally a test case reproducing the issue?

@joloto
Copy link
Author

joloto commented Apr 5, 2024

Hello,

below is the stack trace.
image

This error occurred after updating springdoc-openapi from 2.4.0 -> v2.5.0, not directly invoking swagger ourselves. But I will try to create a small sample project that reproduces the error and will respond again here.

@joloto
Copy link
Author

joloto commented Apr 5, 2024

here is a small demo spring boot app created with Spring Initializr.
demo.zip

It uses springdoc-openapi 2.5.0 which includes swagger-core 2.2.21.

The test ApiDocsTest fails with the aforementioned NullPointerException
(also demonstrated when manually attempting to load the swagger or api-docs endpoints in the browser when running the application).

Everything works when reverting to swagger-core v2.2.20
image

The problem appears to be with the processing of response headers.
image

@frantuma
Copy link
Member

frantuma commented Apr 9, 2024

fixed in #4650

@frantuma frantuma closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants