Skip to content

Conversation

hnguyen08
Copy link

No description provided.

public OmitOperation(@JsonProperty("path") final JsonPointer path,
@JsonProperty("value") final JsonNode value)
{
super(OPERATION_NAME, path, value, PathMissingPolicy.THROW);

Choose a reason for hiding this comment

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

I haven't really tried it, but I'm curious if like we talked about off line if we can turn operations into a composed combination of a source policy, destination policy, and an action. So in this case you'd have an "OmitAction" and a "SourceRequired" being composed together.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I've been thinking about how to do that. I bet you can write a custom deserializer for JsonPatchOperation that will parse the "op", figure out which action and policies, and compose an actual JsonPatchOperation instance composed of the action and policy. This would obviate the need to create all these subclasses of JsonPatchOperation.

The Action implementation would contain the parameters for the action, e.g. path and value. We may still need to use inheritance for serialization of the patch operation, but at least the inheritance would be limited to the major Actions, and not the combinations of Policies.

@huggsboson
Copy link

I'm good with it. Feel free to merge. I would like to consider the alternate formulation for the flavors of Omit at some point, but not enough to block this.

hnguyen08 added a commit that referenced this pull request Sep 25, 2015
Add omit? operation and refactor packages
@hnguyen08 hnguyen08 merged commit b43dda3 into crate-metadata:master Sep 25, 2015
box-ehuang added a commit that referenced this pull request Jun 22, 2016
Hieu Nguyen (10):
    Missed an OPERATION_NAME replace in CopyOperation
    Add omit? operation and refactor packages
    Removing the JsonPatchOperationFactory and just using TypeInfo annotation mixins for jackson deserialization/serialization
    Remove annotations and instead introduce a ExtendedJsonPatch and ExtendedJsonPatchOperation
    Add factory methods for mappers that can deserialize standard and extended JSON patch operations
    Remove ExtendedJsonPatchOperation
    Remove JsonSubTypes annotations on JsonPatchOperation (because we are using registerSubtypes)
    Code review changes
    Creating a Standard and Extended JsonPatchFactory that houses the ObjectMapper
    Set version to 1.12

hnguyen08 (3):
    Merge pull request #2 from hnguyen08/omit_merged
    Merge pull request #3 from hnguyen08/omit_optional_operation
    Merge pull request #6 from hnguyen08/remove_factories_and_support_deserialization

Add missing notes for versions 1.10, 1.11, 1.12
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.

2 participants