Skip to content

Conversation

YangSiJun528
Copy link
Contributor

Motivation:

Resolve issue #5454 with proper handling of ObjectMapper instance.

Modifications:

  • Pass the provided ObjectMapper to the ResponseAs.json method:
    WebClientRequestPreparation.asJson(Class<? extends T> clazz, ObjectMapper mapper).

Result:

Motivation:

Resolve issue line#5454 with proper handling of ObjectMapper instance.

Modifications:

Pass the provided ObjectMapper to the ResponseAs.json method:
  asJson(Class<? extends T> clazz, ObjectMapper mapper).

Result:

The asJson method pass the provided ObjectMapper instance
to the ResponseAs.json method as it should.
@CLAassistant
Copy link

CLAassistant commented Mar 17, 2024

CLA assistant check
All committers have signed the CLA.

@@ -240,7 +240,7 @@ public <T> FutureTransformingRequestPreparation<ResponseEntity<T>> asJson(Class<
ObjectMapper mapper) {
requireNonNull(clazz, "clazz");
requireNonNull(mapper, "mapper");
return asEntity(ResponseAs.json(clazz));
return asEntity(ResponseAs.json(clazz, mapper));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a unit test to detect unexpected changes in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the test code in WebClientRequestPreparationTest.
You can review the changes in the following commit: 8bdcb3e.

However, I am not sure it helps detect unexpected changes in the future.
Could you let me know which test cases should be added?

@github-actions github-actions bot added the Stale label Apr 27, 2024
@minwoox minwoox added this to the 1.30.0 milestone May 21, 2024
@minwoox
Copy link
Contributor

minwoox commented May 21, 2024

@YangSiJun528 Gentle ping. 😉

@YangSiJun528
Copy link
Contributor Author

Sorry for the delayed response. I will add the unit test as requested.

@YangSiJun528 YangSiJun528 force-pushed the fix-as-json-pass-mapper branch from be2bcd1 to ae7754c Compare May 21, 2024 12:46
@YangSiJun528
Copy link
Contributor Author

I mistakenly merged main into this PR branch, so I had to force reset it to undo the changes.

@github-actions github-actions bot removed the Stale label May 22, 2024
Comment on lines 46 to 51
private static WebClient client;

@BeforeAll
static void beforeAll() {
client = WebClient.of(server.httpUri());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't have to have this as a field. We could just use the client in the method.

@YangSiJun528
Copy link
Contributor Author

I have updated the test code to reflect the review comments.
View changes: c7c23ea

@minwoox minwoox modified the milestones: 1.30.0, 1.29.0 May 22, 2024
@minwoox minwoox added the defect label May 22, 2024
Copy link
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank @YangSiJun528! 😄

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

@minwoox minwoox merged commit 2a0dba1 into line:main May 23, 2024
@minwoox
Copy link
Contributor

minwoox commented May 23, 2024

Well done, @YangSiJun528! 😄

Dogacel pushed a commit to Dogacel/armeria that referenced this pull request Jun 8, 2024
…#5512)

Motivation:

Resolve issue line#5454 with proper handling of ObjectMapper instance.

Modifications:

- Pass the provided ObjectMapper to the ResponseAs.json method:
    `WebClientRequestPreparation.asJson(Class<? extends T> clazz, ObjectMapper mapper)`.

Result:

- The `asJson` method pass the provided ObjectMapper instance to the `ResponseAs.json` method as it should
- Closes line#5454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebClientRequestPreparation.asJson not reusing ObjectMapper when specified
5 participants