Add support to configure adding jackson @JsonPOJOBuilder annotations to generated builders#232
Open
maff wants to merge 2 commits intoRandgalt:masterfrom
Open
Add support to configure adding jackson @JsonPOJOBuilder annotations to generated builders#232maff wants to merge 2 commits intoRandgalt:masterfrom
maff wants to merge 2 commits intoRandgalt:masterfrom
Conversation
Contributor
Author
|
@Randgalt any feedback on this approach? I would be great to have this as an option for projects relying on Jackson and still wanting to benefit from RecordBuilder's initialization & defaults logic. |
| return; | ||
| } | ||
|
|
||
| final var annotationSpec = AnnotationSpec |
There was a problem hiding this comment.
I'm afraid it's not that simple. Recently, Jackson 3 was released with changed package names. Is it possible to check what annotations are presented on the classpath and add appropriate annotation here?
…to generated builders
83b9c46 to
227ce69
Compare
Introduces a dedicated Jackson option structure. JSONPojoBuilder support can be enabled with a boolean flag. Detects available jackson version on the classpath and adds the respective annotations when enabled. Jackson version can be set to AUTO (adds annotation for every found version) or to JACKSON_2 or JACKSON_3 (only adds annotations for defined version, fails the build when library is not on the classpath).
227ce69 to
408c108
Compare
Contributor
Author
|
@Randgalt @semyon-levin-workato Updated to support both Jackson 2 and 3 by detecting available classes on the classpath, with support to specify a specific version in case both versions are present. Would be awesome if we could progress with this feature for better out-of-the-box Jackson compatibility. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new option structure to instruct record-builder to add a Jackson
@JsonPOJOBuilderannotation to the generated builder. While this implements library-specifics, it does not add Jackson as dependency (only on the test module).Example usage:
Auto-detect Jackson version (default)
Explicitly add Jackson 2.x annotation (fail if J2 is not available):
With custom setter prefix:
Closes #229