[All SDKs] Allow `writes` and `deletes` to accept empty arrays, but do not forward them to the server
rhamzeh opened this issue · 0 comments
rhamzeh commented
The API currently enforces array lengths to be at least 1
when sent. source
On the SDK side, this provides a subpar developer experience.
Considering OpenFgaClient already wraps the API client, we should allow empty arrays, but do not send them to the server to improve the experience of users using the SDK so that they do not worry about this.
The idea is not to have the app short circuit when both Writes and Deletes are not provided, instead we want to add test and ensure that if they are an empty array, they are not sent (as fields) to the API.
So:
OpenFgaClient User Request | Sent to the API |
---|---|
Write(writes=[tupleA], deletes=[tupleB]) |
Write(writes=[tupleA], deletes=[tupleB]) |
Write(writes=[], deletes=[tupleA]) |
Write(deletes=[tupleA]) |
Write(writes=[tupleA, deletes=[]) |
Write(writes=[tupleA]) |
Write(writes=[], deletes=[]) |
Write() |
- JS SDK
- Go SDK
- .NET SDK
- Python SDK
- Java SDK