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

Add support for Jackson's JsonPOJOBuilder #3688

Merged
merged 1 commit into from
Aug 31, 2019
Merged

Add support for Jackson's JsonPOJOBuilder #3688

merged 1 commit into from
Aug 31, 2019

Conversation

misl
Copy link
Contributor

@misl misl commented Aug 25, 2019

Added support to Jackson extension for immutable POJO models using @JsonPOJOBuilder.

  • Both model and builder are added as reflective classes
  • Also supports model and builder inheritance (add superclasses as well)
  • Added exclusion for @JsonDeserialize without builder field
  • Includes integration tests.

@gsmet gsmet changed the title Fixed issue #3652 Add support for Jackson's JsonPOJOBuilder Aug 26, 2019
@geoand
Copy link
Contributor

geoand commented Aug 26, 2019

Thanks for the contribution!

I took the liebrty of adding thr coding in progress label since a NPE is being thrown as a result of the changes introduced by the PR.

@geoand
Copy link
Contributor

geoand commented Aug 27, 2019

@misl when you are done working on this, please squash your commits into a single one - thanks!

@geoand
Copy link
Contributor

geoand commented Aug 27, 2019

Also, I think that the PR needs to be rebased on master and update the native image CI configuration now that #3719 has been merged

@misl
Copy link
Contributor Author

misl commented Aug 27, 2019

Also, I think that the PR needs to be rebased on master and update the native image CI configuration now that #3719 has been merged

Rebase was performed locally and is building right now. But what is expect from "update the native image CI configuration"?

@geoand
Copy link
Contributor

geoand commented Aug 27, 2019

Because you have added a new integration test module, you need to add something like this

@misl
Copy link
Contributor Author

misl commented Aug 27, 2019

Thanks, added it locally. Will soon commit and push (as local build completed successfully)

@misl
Copy link
Contributor Author

misl commented Aug 27, 2019

Sorry, but I need some help on this one. I have no clue what the vertx integration test compilation errors has to do with my changes.

@geoand
Copy link
Contributor

geoand commented Aug 27, 2019

I saw the same thing earlier in a different PR - but I think it has been fixed on master since so it's probably worth rebasing again

@geoand
Copy link
Contributor

geoand commented Aug 28, 2019

Sorry for this, but it needs another rebase - there have been a lot of CI changes the last 2 days

@misl
Copy link
Contributor Author

misl commented Aug 28, 2019

Help, I need help again. Is this another error due to CI changes.

Sorry to say so, but I am starting to feel like I am wasting time on this.

@geoand
Copy link
Contributor

geoand commented Aug 28, 2019

I'm not on my machine now so I'll take a look in a few hours.

I understand the feeling, but I can assure you that you have experienced particular bad luck having your PR arrive in the middle of large CI changes.

Sorry again for the inconvenience

@misl
Copy link
Contributor Author

misl commented Aug 28, 2019

Let's hope this is not an bad omen ;-)

BTW regarding CI. In my opinion things are scattered all over (overstatement) the repository. Especially for extensions. I needed to make changes in various locations:

  • the extension folder itself: extensions/jackson
  • Integration test: integration-tests/jackson
  • CI pipeline: azure-pipelines.yml
    Personally I would prefer these things in a common extension root module (like extensions/jackson). The integration test could live there as well. The pipeline part can probably we auto generated (convention over configuration).

Like this there is less chance of merge conflicts. Newbies like me need less knowledge about the project structure. If (ever) extensions get separated from core Quarkus it would be a lot less work since all extension related stuff is in a single place. And possible improves development speed (less hopping around).

Sorry, this is just me always trying to improve on (working) things and bringing it rather blunt.

@geoand
Copy link
Contributor

geoand commented Aug 29, 2019

I've restarted the failing test multiple times - same result each time.
None of the other PRs are failing this test so maybe there is something wrong with this PR?

@misl
Copy link
Contributor Author

misl commented Aug 29, 2019

Looking at the log I see no indication that the errors are caused by the Jackson extension. Looks more like the DynamoDB:

2019-08-29T11:15:10.9962932Z 11:15:09,561 INFO  [org.jbo.threads] JBoss Threads version 3.0.0.Beta5
2019-08-29T11:15:11.0949524Z [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.572 s <<< FAILURE! - in io.quarkus.it.dynamodb.DynamoDbFunctionalityTest
2019-08-29T11:15:11.0961581Z [ERROR] testDynamoDbAsync  Time elapsed: 0.022 s  <<< ERROR!
2019-08-29T11:15:11.0962235Z org.junit.jupiter.api.extension.TestInstantiationException: 
2019-08-29T11:15:11.0981185Z TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [io.quarkus.it.dynamodb.DynamoDbFunctionalityTest]: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
2019-08-29T11:15:11.0981944Z 	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 2 deployment problems: 
2019-08-29T11:15:11.0994909Z [1] Unsatisfied dependency for type software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient and qualifiers [@Default]
2019-08-29T11:15:11.0995959Z 	- java member: io.quarkus.it.dynamodb.DynamoDBResource#asyncClient
2019-08-29T11:15:11.0997080Z 	- declared on CLASS bean [types=[io.quarkus.it.dynamodb.DynamoDBResource, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.it.dynamodb.DynamoDBResource]
2019-08-29T11:15:11.1008975Z [2] Unsatisfied dependency for type software.amazon.awssdk.services.dynamodb.DynamoDbClient and qualifiers [@Default]
2019-08-29T11:15:11.1009988Z 	- java member: io.quarkus.it.dynamodb.DynamoDBResource#client
2019-08-29T11:15:11.1024370Z 	- declared on CLASS bean [types=[io.quarkus.it.dynamodb.DynamoDBResource, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.it.dynamodb.DynamoDBResource]
2019-08-29T11:15:11.1025035Z 	at

I will attempt another rebase

@misl
Copy link
Contributor Author

misl commented Aug 30, 2019

Finally, all tests passed :-)

@geoand
Copy link
Contributor

geoand commented Aug 30, 2019

👍

I'll check it out, but as I (think I) mentioned in a previous comment, the PR needs to be squashed to a single commit :)

@geoand
Copy link
Contributor

geoand commented Aug 30, 2019

Much better, thanks!

@FroMage
Copy link
Member

FroMage commented Aug 30, 2019

@geoand, do you intend to review this?

@geoand
Copy link
Contributor

geoand commented Aug 30, 2019

@FroMage yup, absolutely

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

This is really good overall, great job!

I added a few comments, most of which are minor

@geoand
Copy link
Contributor

geoand commented Aug 31, 2019

Once done with the changes, please squash to a single commit.

Thanks!

@misl
Copy link
Contributor Author

misl commented Aug 31, 2019

How to proceed from here?

Do you prefer to review the individual commits or should I first squash (+ rebase) again?

You already answered that. I will squash it now.

@geoand
Copy link
Contributor

geoand commented Aug 31, 2019

Go ahead please with squash and rebase - the PR is not too large to require review per commit I would say

@geoand
Copy link
Contributor

geoand commented Aug 31, 2019

Just a few last minor points I raised. Once they are addressed, I'll approve

- Use @JsonDeserialize (instead of @JsonPOJOBuilder) to add reflective classes.
- Both model and builder are added
- Added safeguard for @JsonDeserialize without builder
- Transformed reproducer project into integration tests for jackson extension.
- Added support for models and model builders with inheritance
@geoand geoand added this to the 0.22.0 milestone Aug 31, 2019
Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

Thank you very much for this!

@geoand geoand added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Aug 31, 2019
IndexView index = combinedIndexBuildItem.getIndex();

// TODO: Here we only check for @JsonDeserialize to detect both Model and Builder
// classes to support @JsonPojoBuilder. The @JsonDeserialize annotiona can
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a typo in annotationa. Also the sentence could possible be expressed in a more clear manner, but it's definitely not something to hold up the PR for :)

@geoand geoand merged commit 79edb31 into quarkusio:master Aug 31, 2019
@gwenneg
Copy link
Member

gwenneg commented Aug 31, 2019

Fixes #3652

@stuartwdouglas
Copy link
Member

For some reason this PR has increased the build time of the kubernetes client native by around 40 minutes.

@geoand
Copy link
Contributor

geoand commented Sep 3, 2019

I'll check it out

@geoand
Copy link
Contributor

geoand commented Sep 3, 2019

Although I need to dig through it, my guess is that now the entire Kubernetes Client model is being registered for reflection, as opposed to being "weakly" registered.

@geoand
Copy link
Contributor

geoand commented Sep 3, 2019

I tweaked the Kubernetes extension in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants