Skip to content
This repository was archived by the owner on Nov 15, 2018. It is now read-only.
This repository was archived by the owner on Nov 15, 2018. It is now read-only.

Honor JsonProperty when serializing a JsonPatchDocument. #29

@KevinDockx

Description

@KevinDockx

An issue was logged on the issue list of Marvin.JsonPatch (on which AspNetCore.JsonPatch is based, which is why I'm logging this issue) regarding honoring JSON.NET's JsonProperty (KevinDockx/JsonPatch#44 (comment)).

The AspNetCore version supports this when applying a patchDoc to a class that has properties decorated with [JsonProperty] attributes. Marvin.JsonPatch doesn't (PCL stuff), so that's not an issue for AspNetCore's version. But it's the last comment of Amnesia1187 that's of importance, as it affects AspNetCore.JsonPatch.

It's regarding creating a JsonPatchDocument on the consumer-side of things. Such a document is serialized to a Json list of operations, and the "path"-portion contains the property name the patch operation affects. That part apparently does not respect JsonProperty values.

So, if you create a JsonPatchDocument, and MyClass contains a property "Name" decorated with JsonProperty("RealName"), it will be serialized to path: "/name" instead of "realName".

I feel it should serialize to realName. Thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions