Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return empty slice if no values are found #8

Merged
merged 2 commits into from
Jan 1, 2024
Merged

Conversation

milosgajdos
Copy link
Owner

@milosgajdos milosgajdos commented Jan 1, 2024

Introducing pagination apparently broke the empty values return which return zero values for slices which are nil which then deserialize to null. This is ok, but we prefer to return empty size slices instead of null. They cost us nothing and are make it more obvious what's happening when curling API.

We also make sure we dont mess this up in the JS so if the null is returned in the future for whatever reason we default to an empty array when processing the API response.

Introducing pagination broke the empty values return.
We now avoid returning empty slice values which are nil in Go and
serialize as nulls in JSON. We also make sure we dont mess this up in
the JS so if the null is returned we default to empty array.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
@milosgajdos milosgajdos merged commit d349d38 into main Jan 1, 2024
4 checks passed
@milosgajdos milosgajdos deleted the empty-values branch January 1, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant