Skip to content

Conversation

@musthafa1996
Copy link
Contributor

@musthafa1996 musthafa1996 commented Sep 4, 2022

New Pull Request Checklist

Issue Description

Enabling allowCustomObjectId forces all objects to have custom objectIds instead of auto-generating when no objectId is passed, or when objectId is null or undefined.

Related issue: #1402

Approach

When allowCustomObjectId is enabled:

  • Check if objectId has a custom value.
  • If objectId has a value and is an empty string, throw 'objectId must not be empty' error.
  • If objectId doesn't have a value, or is null or undefined, generate objectId automatically as if allowCustomObjectId were disabled.

TODOs before merging

  • [x ] Add tests
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)

@parse-github-assistant
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title feat: Generate Parse.Object.objectId automatically when allowCustomObjectId is enabled and no objectId is passed feat: generate Parse.Object.objectId automatically when allowCustomObjectId is enabled and no objectId is passed Sep 4, 2022
@parse-github-assistant
Copy link

parse-github-assistant bot commented Sep 4, 2022

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@codecov
Copy link

codecov bot commented Sep 4, 2022

Codecov Report

Base: 99.94% // Head: 99.94% // No change to project coverage 👍

Coverage data is based on head (c5cc568) compared to base (d3ca00d).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #1540   +/-   ##
=======================================
  Coverage   99.94%   99.94%           
=======================================
  Files          61       61           
  Lines        5955     5955           
  Branches     1360     1360           
=======================================
  Hits         5952     5952           
  Misses          3        3           
Impacted Files Coverage Δ
src/ParseObject.js 99.89% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mtrezza mtrezza requested a review from a team September 4, 2022 12:19
Copy link
Member

@dblythy dblythy left a comment

Choose a reason for hiding this comment

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

Looks mostly good, just some minor refactoring

@musthafa1996
Copy link
Contributor Author

musthafa1996 commented Sep 5, 2022

Thanks for reviewing @dblythy! I have refactored the tests with your suggestions. Can you check again please?

@musthafa1996
Copy link
Contributor Author

Hi @dblythy! Were you able to have a look at the recent changes pushed to the PR?

@dblythy
Copy link
Member

dblythy commented Sep 6, 2022

You might need to run npm run lint and fix syntax errors. I couldn't suggest changes to be syntactically correct as I couldn't provide suggestions across deleted lines.

@musthafa1996
Copy link
Contributor Author

You might need to run npm run lint and fix syntax errors. I couldn't suggest changes to be syntactically correct as I couldn't provide suggestions across deleted lines.

Thanks. I’ll run and post the results.

@musthafa1996
Copy link
Contributor Author

musthafa1996 commented Sep 6, 2022

@dblythy, my bad. I have just fixed the syntax error and updated the PR. Please have a look now.

The following is the result of npm run lint:
Screenshot 2022-09-06 at 3 55 43 PM

The following is the result of npm run test:
Screenshot 2022-09-06 at 3 56 39 PM
Screenshot 2022-09-06 at 3 56 59 PM

Copy link
Member

@dblythy dblythy left a comment

Choose a reason for hiding this comment

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

Sorry, I just worked out how to properly suggest 😂.

Almost there, @mtrezza can you allow the tests to run?

@musthafa1996
Copy link
Contributor Author

I had been careful enough this time while refactoring. Can you check yet again, @dblythy ? :)

@musthafa1996
Copy link
Contributor Author

@mtrezza, @dblythy, have you checked the latest changes?

@dblythy
Copy link
Member

dblythy commented Sep 7, 2022

I will review again within 24 hrs 😊

@musthafa1996
Copy link
Contributor Author

Thank you 😊

@dblythy
Copy link
Member

dblythy commented Sep 8, 2022

Can you check the integration check? npm run integration

@musthafa1996
Copy link
Contributor Author

musthafa1996 commented Sep 9, 2022

Can you check the integration check? npm run integration

Hi @dblythy and @mtrezza! I did get some time to look into this PR today. I have pushed the following updates:

  • Remove unnecessary id existence check from ParseObject in case allowCustomObjectId is true.
  • Fix tests for allowCustomObjectId.

Turns out that we don't need the following checks in ParseObject as they are already validated from ParseServer.

Screenshot 2022-09-10 at 2 09 40 AM

Screenshot 2022-09-10 at 2 09 55 AM

All the related tests seem to work fine now.

@musthafa1996
Copy link
Contributor Author

What's pending for this PR to be merged now @dblythy, @mtrezza?

@mtrezza
Copy link
Member

mtrezza commented Sep 21, 2022

Waiting for CI to pass

@musthafa1996
Copy link
Contributor Author

CI has been completed successfully.

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.

Looks good!

@mtrezza
Copy link
Member

mtrezza commented Sep 21, 2022

@dblythy Is this ready for merge also from your side?

@mtrezza mtrezza merged commit 68f3ff5 into parse-community:alpha Sep 21, 2022
parseplatformorg pushed a commit that referenced this pull request Sep 21, 2022
# [3.5.0-alpha.4](3.5.0-alpha.3...3.5.0-alpha.4) (2022-09-21)

### Features

* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.0-alpha.4

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Sep 21, 2022
@musthafa1996
Copy link
Contributor Author

Thanks for merging @mtrezza and @dblythy :)

@musthafa1996 musthafa1996 deleted the allow-custom-id branch September 22, 2022 06:33
@dblythy
Copy link
Member

dblythy commented Sep 22, 2022

Thanks for your contribution!! 🔥

@musthafa1996
Copy link
Contributor Author

Hi @mtrezza! When can we expect version 3.5.0 to be released?

@mtrezza
Copy link
Member

mtrezza commented Sep 24, 2022

The release cycle is monthly (around the beginning of every month): alpha -> beta -> release
This feature will be in beta in Okt. and in stable release in Nov.

@musthafa1996
Copy link
Contributor Author

Got it. Thanks for letting me know @mtrezza 😊

parseplatformorg pushed a commit that referenced this pull request Oct 25, 2022
# [3.5.0-beta.1](3.4.4...3.5.0-beta.1) (2022-10-25)

### Bug Fixes

* `Parse.User.signUp()` does not pass context to Cloud Code  ([#1527](#1527)) ([53edcfd](53edcfd))
* `Schema.addField` does not correctly add value of type `Date` ([#1544](#1544)) ([15111f7](15111f7))
* creating a Parse.File with base64 string fails for some encodings ([#1517](#1517)) ([0439862](0439862))
* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
* remove base64 validation due to validation inefficiency ([#1543](#1543)) ([473949d](473949d))

### Features

* add `json` option to `Parse.Query.each()` ([#1539](#1539)) ([89fd5ec](89fd5ec))
* add json option to query.each ([299fb0d](299fb0d))
* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
* localDatastore support for unsorted distance queries ([#1570](#1570)) ([ea3e75f](ea3e75f))
@parseplatformorg
Copy link
Contributor

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

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Oct 25, 2022
parseplatformorg pushed a commit that referenced this pull request Nov 1, 2022
# [3.5.0](3.4.4...3.5.0) (2022-11-01)

### Bug Fixes

* `Parse.User.signUp()` does not pass context to Cloud Code  ([#1527](#1527)) ([53edcfd](53edcfd))
* `Schema.addField` does not correctly add value of type `Date` ([#1544](#1544)) ([15111f7](15111f7))
* creating a Parse.File with base64 string fails for some encodings ([#1517](#1517)) ([0439862](0439862))
* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
* remove base64 validation due to validation inefficiency ([#1543](#1543)) ([473949d](473949d))

### Features

* add `json` option to `Parse.Query.each()` ([#1539](#1539)) ([89fd5ec](89fd5ec))
* add json option to query.each ([299fb0d](299fb0d))
* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
* localDatastore support for unsorted distance queries ([#1570](#1570)) ([ea3e75f](ea3e75f))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Nov 1, 2022
mtrezza pushed a commit that referenced this pull request Nov 3, 2022
* `Parse.User.signUp()` does not pass context to Cloud Code  ([#1527](#1527)) ([53edcfd](53edcfd))
* `Schema.addField` does not correctly add value of type `Date` ([#1544](#1544)) ([15111f7](15111f7))
* creating a Parse.File with base64 string fails for some encodings ([#1517](#1517)) ([0439862](0439862))
* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
* remove base64 validation due to validation inefficiency ([#1543](#1543)) ([473949d](473949d))

* add `json` option to `Parse.Query.each()` ([#1539](#1539)) ([89fd5ec](89fd5ec))
* add json option to query.each ([299fb0d](299fb0d))
* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
* localDatastore support for unsorted distance queries ([#1570](#1570)) ([ea3e75f](ea3e75f))
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-alpha Released as alpha version state:released-beta Released as beta version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option allowCustomObjectId forces all objects to have custom objectId

4 participants