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.
The API currently enforces array lengths to be at least
1
when sent. sourceOn 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.
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()