JSON Patch for modern PATCH APIs.
Project description
JsonPatchX
JSON Patch for modern PATCH APIs. Tested against the RFC 6902 Compliance Test Suite.
Built on Pydantic models, with typed JSON Pointer / JSONPath targeting, custom patch operations, and first-class support for FastAPI PATCH routes and OpenAPI generation.
Table of Contents
Install
pip install jsonpatchx
For FastAPI integrations:
pip install jsonpatchx[fastapi]
Links
- Documentation: https://angela-tarantula.github.io/jsonpatchx/user-guide/getting-started
- Chengelog: https://github.com/angela-tarantula/jsonpatchx/blob/main/CHANGELOG.md
- PyPI: https://pypi.org/project/jsonpatchx
- Source code: https://github.com/angela-tarantula/jsonpatchx
- Issue tracker: https://github.com/angela-tarantula/jsonpatchx/issues
- Project Discussions: https://github.com/angela-tarantula/jsonpatchx/discussions
- IETF Future Standards Discussions: https://github.com/json-patch/json-patch2
Examples
1. Standard RFC 6902
from jsonpatchx import JsonPatch
doc = {"name": "Ada", "roles": ["engineer"]}
patch = JsonPatch.from_string(
"""
[
{"op": "replace", "path": "/name", "value": "Ada Lovelace"},
{"op": "add", "path": "/roles/-", "value": "maintainer"}
]
"""
)
updated = patch.apply(doc)
2. The FastAPI Contract
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
from jsonpatchx import JsonPatchFor
class User(BaseModel):
id: int
email: EmailStr
active: bool
app = FastAPI()
@app.patch("/users/{user_id}", response_model=User)
def patch_user(user_id: int, patch: JsonPatchFor[User]) -> User:
user = load_user(user_id)
updated = patch.apply(user)
save_user(user_id, updated)
return updated
Note: For custom operations, JSONPath targeting, route-level controls, and more, see the User Guide.
Contributing
See CONTRIBUTING.md for local setup, checks, docs preview, and pull request expectations.
Use Discussions for project-specific design conversation, issues for concrete bugs or proposed work, and the broader json-patch2 forum for standards discussion.
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Angela Liss - chamsester@gmail.com
Project Link: https://github.com/angela-tarantula/jsonpatchx
Acknowledgements
Thanks to these foundational projects:
And to these excellent alternatives:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsonpatchx-0.1.0.tar.gz.
File metadata
- Download URL: jsonpatchx-0.1.0.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
234d3b725d2751a81ef51930b0e8c336fa2c5491be7a843b1a85b08c824f1ade
|
|
| MD5 |
e504b809d3ee49fa957319a55a98af11
|
|
| BLAKE2b-256 |
cecc61d30b11cf2690aeea783b460587d9952a04187679cae5b913b01751e92a
|
Provenance
The following attestation bundles were made for jsonpatchx-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on angela-tarantula/jsonpatchx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jsonpatchx-0.1.0.tar.gz -
Subject digest:
234d3b725d2751a81ef51930b0e8c336fa2c5491be7a843b1a85b08c824f1ade - Sigstore transparency entry: 1375839828
- Sigstore integration time:
-
Permalink:
angela-tarantula/jsonpatchx@4c5906af9a63174629109c45343df4c7d89b207e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/angela-tarantula
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4c5906af9a63174629109c45343df4c7d89b207e -
Trigger Event:
release
-
Statement type:
File details
Details for the file jsonpatchx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jsonpatchx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 44.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bce314a19515090dc464ce11fa59e66905c2eda9b51bfbf0897ccbae68c8034
|
|
| MD5 |
9d2f52e33b109f0c04f701bb63eb4573
|
|
| BLAKE2b-256 |
f34a9963ceeb4f114a9f87e318226c0b44e0f9b394e983f809bb27a86cdd4562
|
Provenance
The following attestation bundles were made for jsonpatchx-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on angela-tarantula/jsonpatchx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jsonpatchx-0.1.0-py3-none-any.whl -
Subject digest:
0bce314a19515090dc464ce11fa59e66905c2eda9b51bfbf0897ccbae68c8034 - Sigstore transparency entry: 1375839848
- Sigstore integration time:
-
Permalink:
angela-tarantula/jsonpatchx@4c5906af9a63174629109c45343df4c7d89b207e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/angela-tarantula
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4c5906af9a63174629109c45343df4c7d89b207e -
Trigger Event:
release
-
Statement type: