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

api: return error if no tuples/objects #382

Conversation

DifferentialOrange
Copy link
Member

Before this patch, the behavior of *_many requests if empty array of tuples/objects were rather confusing. For example, due to format processing all *_object_many operations resulted in nil, {} -- error request with zero errors. insert_many and replace_many calls result in nil, nil -- no result, no error. upsert_many results in {metadata = metadata}, nil with no rows in response. Thus, for all six *_many calls trying to execute the request with empty array on input result in malformed response.

After this patch, trying to run *_many request with empty array of tuples/objects will result in nil, {err}, similar to existing *_many API. Single tuple crud API already does not allow to run with no tuples/objects.

Closes #377

@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-377-no-rows-error branch 2 times, most recently from d9f088a to c395f3c Compare October 5, 2023 14:54
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/no-gh-schema branch 2 times, most recently from 00ebe5f to 06a92c8 Compare October 9, 2023 13:40
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-377-no-rows-error branch from c395f3c to 1aad7d2 Compare October 9, 2023 13:41
Before this patch, the behavior of `*_many` requests if empty array of
tuples/objects were rather confusing. For example, due to format
processing all `*_object_many` operations resulted in `nil, {}` --
error request with zero errors. `insert_many` and `replace_many` calls
result in `nil, nil` -- no result, no error. `upsert_many` results in
`{metadata = metadata}, nil` with no `rows` in response. Thus, for all
six `*_many` calls trying to execute the request with empty array on
input result in malformed response.

After this patch, trying to run `*_many` request with empty array of
tuples/objects will result in `nil, {err}`, similar to existing
`*_many` API. Single tuple crud API already does not allow to run with
no tuples/objects.

Closes #377
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-377-no-rows-error branch from 1aad7d2 to 9f0e33e Compare October 9, 2023 14:00
@DifferentialOrange DifferentialOrange marked this pull request as ready for review October 9, 2023 14:06
@DifferentialOrange DifferentialOrange merged commit 20a20c6 into DifferentialOrange/no-gh-schema Oct 10, 2023
@DifferentialOrange DifferentialOrange deleted the DifferentialOrange/gh-377-no-rows-error branch October 10, 2023 07:43
@DifferentialOrange DifferentialOrange restored the DifferentialOrange/gh-377-no-rows-error branch October 10, 2023 07:44
@DifferentialOrange DifferentialOrange deleted the DifferentialOrange/gh-377-no-rows-error branch October 10, 2023 07:59
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.

2 participants