-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Summary
Add support for JSON Merge Patch (RFC 7396) as a PATCH content type for JSON-LD resources.
Motivation
Currently JSS supports N3 Patch and SPARQL Update for PATCH operations, which are RDF-centric and verbose for simple field updates. JSON Merge Patch is a natural fit for JSON-LD resources:
PATCH /profile/card.jsonld
Content-Type: application/merge-patch+json
{"foaf:name": "New Name", "foaf:nick": "newnick"}This merges the patch into the existing JSON-LD, updating only the specified fields.
Spec
- RFC 7396 — JSON Merge Patch
- Null values remove keys:
{"foaf:nick": null}deletes the field - Nested objects merge recursively
- Arrays are replaced, not merged
Implementation
In the PATCH handler (src/handlers/resource.js):
- Check
Content-Type: application/merge-patch+json - Read existing resource as JSON
- Apply merge patch (recursive merge, ~10 lines)
- Write back
Use cases
- Profile editing (update name, add links)
- Any JSON-LD resource field update
- Simpler alternative to N3 Patch for JSON-native clients
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels