python-json-patch icon indicating copy to clipboard operation
python-json-patch copied to clipboard

Option for case-insensitiveness?

Open Torniojaws opened this issue 8 years ago • 1 comments

I'm not sure if I'm doing it wrong, but I have this question:

Say, I receive a patch to my API:

PATCH /news/123
[
    {"op": "replace", "path": "/title", "value": "Example"}
]

But the target DB column is News.Title. The patch will fail because title !== Title.

Does the package have something that allows case-insensitiveness. Or alternatively, where could I place a mapping function that defines for example:

def mapping(self, path):
    select = {
        "/title": "Title,
        "/authorname": "AuthorName"
    }
    return select.get(path, None)

I guess this question would be valid for any language.

Thanks!

Torniojaws avatar Sep 08 '17 15:09 Torniojaws

Well, I implemented the mapping and it works so far.

Torniojaws avatar Sep 08 '17 22:09 Torniojaws