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

WarningMixing/WrappingMixing in PageModule overrides user defined Jackson annotations. #3114

Open
arvydzutis opened this issue Jun 25, 2024 · 2 comments
Labels
status: feedback-provided Feedback has been provided

Comments

@arvydzutis
Copy link

Encountered while migrating Spring Boot from 3.2.7 to 3.3.1.
If custom class has extended PageImpl, the annotations, such as @JsonIgnoreProperties, does not work because of WarningMixing or WrappingMixing is now registered.

@JsonIgnoreProperties(ignoreUnknown = true, value = {"pageable"})
public class RestPage<T> extends PageImpl<T> {
...
}

The only way to fix this is to override the mixin:

objectMapper.addMixIn(PageImpl.class, RestPageMixin.class);
public interface RestPageMixin {
    @JsonIgnore
    Pageable getPageable();
}

Is it a bug or should we move to PagedModel?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 25, 2024
@christophstrobl
Copy link
Member

It would be great if you could please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

@christophstrobl christophstrobl added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 1, 2024
@arvydzutis
Copy link
Author

arvydzutis commented Jul 1, 2024

sample.zip

  1. curl -v localhost:9191/
  2. Response includes "pageable"
  3. Change Spring Boot from 3.3.1 to 3.2.7.
  4. curl -v localhost:9191/
  5. Response does not include "pageable"

So @JsonIgnoreProperties(ignoreUnknown = true, value = {"pageable"}) is ignored in 3.3.1 because WarningMixing was introduced.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants