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 select exclude queries #7242

Merged
merged 45 commits into from
Jun 3, 2021
Merged

Fix select exclude queries #7242

merged 45 commits into from
Jun 3, 2021

Conversation

cbaker6
Copy link
Contributor

@cbaker6 cbaker6 commented Mar 5, 2021

New Pull Request Checklist

Issue Description

Related issue: to an issue discovered and Fixes #7245 and on the Parse-Swift SDK, parse-community/Parse-Swift#88

The keys and excludeKeys on the server are not digesting actual JSON arrays, ["yolo", ...], but instead digesting "yolo", .... Somehow JS treats both of these the same (I say this because the fixed PR I have for the server works with just removing 1 test case, more on this in the PR), but the server doesn't like it the way the Swift JSON encoder sends it, ["yolo", ...]. Note that this is the JSON encoder straight from Apples Swift source code and not the custom one used here for ParseObjects, so if it was encoding arrays incorrectly I'm sure it would have been caught awhile ago.

This PR has the possibility of being breaking change for some users due to:

This is the test case I removed because it 1) doesn't work anymore 2) not sure why we want this particular functionality for select. If you really want to exclude all keys, there should probably create an excludeAll or an exclude(["*"]

Approach

Make keys and excludeKeys use the same strategy as a similar property like include which takes array of strings also,

if (body.keys) {
options.keys = String(body.keys);
}
if (body.include) {
options.include = String(body.include);
}
if (body.excludeKeys) {
options.excludeKeys = String(body.excludeKeys);
}

TODOs before merging

spec/ParseQuery.spec.js Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #7242 (b06bf76) into master (5abbeeb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7242   +/-   ##
=======================================
  Coverage   93.90%   93.90%           
=======================================
  Files         181      181           
  Lines       13210    13228   +18     
=======================================
+ Hits        12405    12422   +17     
- Misses        805      806    +1     
Impacted Files Coverage Δ
src/RestQuery.js 95.70% <100.00%> (+0.17%) ⬆️
src/Routers/ClassesRouter.js 97.95% <100.00%> (ø)
src/RestWrite.js 93.92% <0.00%> (-0.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5abbeeb...b06bf76. Read the comment docs.

@mtrezza
Copy link
Member

mtrezza commented Mar 5, 2021

Thanks for the PR. I think we would do good to either move the issue to this repo or create an additional issue in Parse Server. By experience we see that follow up discussion and issue search almost exclusively happens in issues rather than PR. I would also like to better understand what the issue here is.

I think we have to be careful in removing or changing a test case. I actually just fixed a Parse Server issue for select([]) some weeks ago and I would like to better understand what the issue around this PR is. Is this removing the possibility of select with an empty array? I would like to have this discussion in a separate Parse Server issue.

@cbaker6
Copy link
Contributor Author

cbaker6 commented Mar 5, 2021

I think codecov is reporting in the PR incorrectly, when you look at the full report there's actually a slight increase instead of decrease https://app.codecov.io/gh/parse-community/parse-server/compare/7242

@mtrezza mtrezza self-requested a review March 5, 2021 17:43
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to mention that there is an ongoing discussion about this change in the issue. So that this doesn't get merged by mistake before we come to a conclusion.

cbaker6 added a commit to cbaker6/docs that referenced this pull request Mar 6, 2021
Supports changes made in pending [PR](parse-community/parse-server#7242). Can see [here](parse-community/parse-server#7245) for further discussion.
@cbaker6 cbaker6 closed this Apr 9, 2021
@cbaker6 cbaker6 reopened this Apr 9, 2021
@cbaker6 cbaker6 closed this Apr 23, 2021
@cbaker6 cbaker6 reopened this Apr 23, 2021
@cbaker6
Copy link
Contributor Author

cbaker6 commented May 1, 2021

@dplewis are you able to review this PR? The comparison of what's fixed compared to the main is in my previous comment

@dplewis
Copy link
Member

dplewis commented May 20, 2021

@cbaker6 sorry for the late reply. I’ll review this in detail this weekend

@cbaker6
Copy link
Contributor Author

cbaker6 commented Jun 1, 2021

@dplewis let me know if any additional questions come up regarding this PR

Copy link
Member

@dplewis dplewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbaker6 Sorry for the late reply and thank you for this PR. I have a few comments.

src/RestQuery.js Outdated Show resolved Hide resolved
src/RestQuery.js Show resolved Hide resolved
Copy link
Member

@dplewis dplewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dplewis dplewis merged commit 6d13aea into parse-community:master Jun 3, 2021
@cbaker6 cbaker6 deleted the fixSelectExclude branch August 4, 2021 04:33
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Nov 1, 2021
@mtrezza mtrezza mentioned this pull request Mar 12, 2022
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select and Exclude queries do not properly digest JSON arrays Exclude child elements in query results
5 participants