-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
return false; | ||
} | ||
} catch (SerdeException e) { | ||
throw new RuntimeException(e); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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"() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional too
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the JsonInclude javadoc, I think this should be the default impl of isAbsent for all types: https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-annotations/latest/com/fasterxml/jackson/annotation/JsonInclude.Include.html#NON_ABSENT
There was a problem hiding this comment.
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
|
No description provided.