Closed mattnelson closed 1 year ago
To simplify the serialization of json-p patch objects, proposing adding delegating serializers for JsonPatch>JsonArray and JsonMergePatch>JsonValue
It takes extra steps to convert a patch into a type that has a serializer available.
addSerializer(JsonPatch.class, new StdDelegatingSerializer(new Converter<JsonPatch, JsonArray>() { @Override public JsonArray convert(JsonPatch value) { return value.toJsonArray(); } @Override public JavaType getInputType(TypeFactory typeFactory) { return typeFactory.constructFromCanonical(JsonPatch.class.getName()); } @Override public JavaType getOutputType(TypeFactory typeFactory) { return typeFactory.constructFromCanonical(JsonArray.class.getName()); } }));
Sounds good to me. Since this does not require changes to API, could even go in 2.14(.2) patch.
Implemented as suggested; will be included in 2.14.2
To simplify the serialization of json-p patch objects, proposing adding delegating serializers for JsonPatch>JsonArray and JsonMergePatch>JsonValue
It takes extra steps to convert a patch into a type that has a serializer available.