-
Notifications
You must be signed in to change notification settings - Fork 26
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
595: Fix resource serialization #596
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
import com.fasterxml.jackson.databind.DatabindContext; | ||
import com.fasterxml.jackson.databind.JavaType; | ||
import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase; | ||
import io.openraven.magpie.data.Resource; | ||
import io.openraven.magpie.data.exception.MissingEntityTypeException; | ||
import org.reflections.Reflections; | ||
|
||
|
@@ -80,13 +81,16 @@ public void init(JavaType javaType) { | |
} | ||
|
||
@Override | ||
public String idFromValue(Object o) { | ||
return idFromValueAndType(o, o.getClass()); | ||
public String idFromValue(Object object) { | ||
return idFromValueAndType(object, object.getClass()); | ||
} | ||
|
||
@Override | ||
public String idFromValueAndType(Object o, Class<?> aClass) { | ||
return null; | ||
public String idFromValueAndType(Object object, Class<?> aClass) { | ||
if (object instanceof Resource) { | ||
return ((Resource) object).getResourceType(); | ||
} | ||
return aClass.getName(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously under Jackson version 2.13.5 by returning null here and
Now Jackson 2.15.4 doesn't allow to set null to resolving id and we were getting mentioned expection:
With above fix we are getting now.
When we set
|
||
} | ||
|
||
@Override | ||
|
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.
With value PROPERTY we were getting two
resourceType
in serialized string: