stefankoegl / python-json-patch

Applying JSON Patches in Python
https://python-json-patch.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
440 stars 96 forks source link

Option for case-insensitiveness? #69

Open Torniojaws opened 7 years ago

Torniojaws commented 7 years ago

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 commented 7 years ago

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