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

Jackson-databind reflection problem with swagger-ui #10220

Open
mebigfatguy opened this issue Nov 20, 2024 · 3 comments
Open

Jackson-databind reflection problem with swagger-ui #10220

mebigfatguy opened this issue Nov 20, 2024 · 3 comments

Comments

@mebigfatguy
Copy link

Using swagger-ui version 2.2.26 and jackson-databind version 2.18.1, on jdk21, i get tons of these errors..

ERROR io.swagger.v3.core.jackson.ModelResolver - Neither 'findJsonValueMethod' nor 'findJsonValueAccessor' found in jackson BeanDescription. Please verify your Jackson version.

When i look in jackson-databind, findJsonValueMethod has indeed been recently removed but i do see

/**
 * Method for locating accessor (readable field, or "getter" method)
 * that has
 * {@link com.fasterxml.jackson.annotation.JsonValue} annotation,
 * if any. If multiple ones are found,
 * an error is reported by throwing {@link IllegalArgumentException}
 *
 * @since 2.9
 */
public abstract AnnotatedMember findJsonValueAccessor();

So i was wondering if anyone could tell me what i am doing wrong here??
(it would also be nice to log beanDesc.getClass().getClassName() in that error message.)

@funfried
Copy link

I have the same issue, it seems it's related to having webflux and webmvc libraries inside the classpath (which is not good and I have to fix that in my case sometime), but what's strange is that the error message disappears when downgrading back to swagger 2.2.25 still having webflux and webmvc in my classpath.

@ftreede
Copy link

ftreede commented Nov 26, 2024

This is definetely a bug in swagger. Jackson removed the deprecated findJsonValueMethod method with 2.18: FasterXML/jackson-databind#4525

https://github.com/swagger-api/swagger-core/blob/df88c8a8ebaae1cb8ec39d1af295d07620dcaf87/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java#L1157-L1179

This code first tries the new method, finds it and invokes it. However, if that method returns null, the return is not called and it then tries the old method.

@ftreede
Copy link

ftreede commented Nov 26, 2024

This is actually an issue in swagger, core: check over there: swagger-api/swagger-core#4755

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

3 participants