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

Implement @JsonInclude(content= #1050

Merged
merged 4 commits into from
Feb 26, 2025
Merged

Implement @JsonInclude(content= #1050

merged 4 commits into from
Feb 26, 2025

Conversation

dstepanov
Copy link
Contributor

No description provided.

return false;
}
} catch (SerdeException e) {
throw new RuntimeException(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

need to throw a more specific exception here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

What I mean was a more specific exception type. If this is a configuration error maybe ConfigurationException?

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 a sneaky throw so the original exception is thrown withou changes

@@ -82,53 +82,4 @@ class Test {
context.close()
}

void "test json any getter / setter - records"() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume these deleted tests were moved to the TCK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@@ -103,6 +104,22 @@ public void serializeInto(Encoder encoder, EncoderContext context, Argument<? ex
default:
// fall through
}
if (property.include != SerdeConfig.SerInclude.ALWAYS && property.include != SerdeConfig.SerInclude.NON_NULL) {
switch (property.includeContent) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think jackson does it this way

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Optional too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the common methods and logic and moved it to the optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a bit strange that you cannot exclude empty values from List

@@ -48,6 +48,11 @@ public String deserializeNullable(@NonNull Decoder decoder, @NonNull DecoderCont
return decoder.decodeStringNullable();
}

@Override
public boolean isAbsent(EncoderContext context, String value) {
return value == null;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's the same as the super method

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 New Bugs (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@dstepanov dstepanov merged commit b82195d into 2.15.x Feb 26, 2025
17 of 18 checks passed
@dstepanov dstepanov deleted the fixig branch February 26, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants