-
Notifications
You must be signed in to change notification settings - Fork 794
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
OpenFeign client cannot correctly deserialize from stable page representation #1144
Comments
Thanks for reporting the issue, @fenuks. This would be a new enhancement. In general, we don't add enhancements to this project anymore, as it's in maintenance mode now (we suggest migrating over to Spring Interface Clients), but I think we may add support for this. However, I'm not sure when we'll be able to put this in the backlog, as maintenance-only projects have low priority. Feel free to submit a PR if you'd like it to be included faster. |
I could try to do that. It would be great if both page representations were supported at the same time, but I'm not sure if it is possible with current implementation based on Jackson module? |
@fenuks we need to support both. Could be using an opt-in flag for the new mode as the old mode hasn't been deprecated and is still in use. Then, in the next major release, we could swap the defaults. |
Yes, I would like to support them both, but I wonder if we could support both without any flag. Currently JacksonModule is being used and Jackson calls this constructor: SimplePageImpl(@JsonProperty("content") List<T> content,
@JsonProperty("pageable") Pageable pageable,
@JsonProperty("number") @JsonAlias("pageNumber") int number,
@JsonProperty("size") @JsonAlias("pageSize") int size,
@JsonProperty("totalElements") @JsonAlias({ "total-elements",
"total_elements", "totalelements",
"TotalElements", "total" }) long totalElements,
@JsonProperty("sort") Sort sort) Fixing it to new representation is easy, one needs to rewrite it to SimplePageImpl(@JsonProperty("content") List<T> content,
@JsonProperty("page") PagedModel.PageMetadata page), Sorry for lack of clarity, what I was asking in previous post, is if we can support both page representations at the same time using Say, I have feign client that consumes controller that for methods written pre-SB 3.0 still uses old page format for compatibility reasons, but all new methods use new stable format. |
Describe the bug
I use new stable page representation format enabled with
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
.When I try to download paged response from controller via feign client, page metadata isn't correctly parsed. Total elements number always equals number of elements in current page content (page content is parsed correctly). It seems that PageJacksonModule expects page metadata in the old format.
I'm using Spring Cloud v2024.0.0.
Sample
Sample project to reproduce this problem lives at
https://github.com/exempla/sb3_stable_page_feign_deserialization_problem. Run
mvn test
to see the error.The text was updated successfully, but these errors were encountered: