-
Notifications
You must be signed in to change notification settings - Fork 15
Add support for ignoring duplicate write tuple keys and missing delete tuple keys #121
Description
Checklist
- I agree to the terms within the OpenFGA Code of Conduct.
Describe the problem you'd like to have solved
According to the OpenFGA API docs, and after testing this locally, the OpenFGA API supports setting "on_duplicate": "ignore" within the writes object and "on_missing": "ignore" on the deletes object.
Could we add support for this as well?
Describe the ideal solution
Client Write and Delete options could support these values, which would then be added in the writes and deletes object.
Users spend a lot of time working around errors resulting from writing an already existing tuple or deleting a non-existent one.
Describe the ideal solution
OpenFGA v1.10.0 introduced support for write conflict options (on missing/on duplicate).
The SDKs must expose that in the underlying API client and models, as well as add support for idempotency options in the SDK client interface.
As an example for Go (each SDK should follow it's own similar conventions), the client should support the following options through ClientWriteOptions.Conflict:
OnDuplicateWrites: Controls behavior when writing a tuple that already exists
CLIENT_WRITE_REQUEST_ON_DUPLICATE_WRITES_IGNORE- Silently skip duplicate writesCLIENT_WRITE_REQUEST_ON_DUPLICATE_WRITES_ERROR- Return error on duplicates (default)
OnMissingDeletes: Controls behavior when deleting a tuple that doesn't existCLIENT_WRITE_REQUEST_ON_MISSING_DELETES_IGNORE- Silently skip missing deletesCLIENT_WRITE_REQUEST_ON_MISSING_DELETES_ERROR- Return error on missing deletes (default)
options := client.ClientWriteOptions{
Conflict: client.ConflictOptions{
OnDuplicateWrites: client.CLIENT_WRITE_REQUEST_ON_DUPLICATE_WRITES_ERROR,
OnMissingDeletes: client.CLIENT_WRITE_REQUEST_ON_MISSING_DELETES_IGNORE,
},
}If the user does not set the default, the SDK should not send it, relying on the server to implement its default behaviour.
Ensure that the:
- Change has tests for both the OpenFgaApi and OpenFgaClient layers
- The Write section in the README is appropriately updated
- The unreleased section of the Changelog is updated
Alternatives and current workarounds
No response
References
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status