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

Adds deprecator #7303

Merged
merged 7 commits into from
Mar 30, 2021
Merged

Adds deprecator #7303

merged 7 commits into from
Mar 30, 2021

Conversation

mtrezza
Copy link
Member

@mtrezza mtrezza commented Mar 29, 2021

New Pull Request Checklist

Issue Description

Currently, there is no mechanism provided to deprecate Parse Server settings.

Related issue: closes #7302

Approach

Adds a new Deprecator in ./Deprecator directory.

Features:

  • Covers the following deprecation scenarios:
    • renaming / refactoring of option name
    • change of option default value
    • removal of option
  • All deprecations defined in ./Deprecator/Deprecations.js in a standardized way to
    • make it easy to manage deprecations
    • make it easy for contributors to identify features that are being phased out
  • Minimal effort required to log a warning
  • Deprecations logged as warnings at Parse Server launch
  • Deprecator works for launching Parse Server via CLI or as module (new ParseServer(...))

Examples

  • Log that someFeature option default will change from false to true:
    { optionKey: 'someFeature', changeNewDefault: 'true' }
    

    DeprecationWarning: The Parse Server option 'someFeature' default will change to 'true' in a future version.

  • Log that someFeature option name will change to somethingElse:
    { optionKey: 'someFeature', changeNewKey: 'somethingElse' }
    

    DeprecationWarning: The Parse Server option 'someFeature' is deprecated and will be renamed to 'sometimeElse' in a future version.

  • Log that someFeature option name will be removed:
    { optionKey: 'someFeature', changeNewKey: '' }
    

    DeprecationWarning: The Parse Server option 'someFeature' is deprecated and will be removed in a future version.

TODOs before merging

  • Add test cases
  • Add entry to changelog
  • [ ] Add changes to documentation (guides, repository pages, in-code descriptions) to be added in Add deprecation policy #7199

@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #7303 (6e087dc) into master (bc08b54) will decrease coverage by 7.66%.
The diff coverage is 92.10%.

❗ Current head 6e087dc differs from pull request most recent head 627f66d. Consider uploading reports for the commit 627f66d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7303      +/-   ##
==========================================
- Coverage   93.93%   86.26%   -7.67%     
==========================================
  Files         179      181       +2     
  Lines       13153    13190      +37     
==========================================
- Hits        12355    11379     -976     
- Misses        798     1811    +1013     
Impacted Files Coverage Δ
src/GraphQL/loaders/usersMutations.js 91.20% <80.00%> (-2.22%) ⬇️
src/Deprecator/Deprecations.js 100.00% <100.00%> (ø)
src/Deprecator/Deprecator.js 100.00% <100.00%> (ø)
src/ParseServer.js 89.88% <100.00%> (+0.11%) ⬆️
src/cli/utils/commander.js 100.00% <100.00%> (ø)
src/Adapters/Storage/Mongo/MongoCollection.js 4.76% <0.00%> (-92.86%) ⬇️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 12.20% <0.00%> (-80.40%) ⬇️
src/Adapters/Cache/RedisCacheAdapter.js 12.28% <0.00%> (-75.44%) ⬇️
src/Adapters/Files/GridFSBucketAdapter.js 10.65% <0.00%> (-69.68%) ⬇️
...rc/Adapters/Storage/Mongo/MongoSchemaCollection.js 37.07% <0.00%> (-60.68%) ⬇️
... and 26 more

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 bc08b54...627f66d. Read the comment docs.

Copy link
Member

@davimacedo davimacedo left a comment

Choose a reason for hiding this comment

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

LGTM!

@mtrezza
Copy link
Member Author

mtrezza commented Mar 29, 2021

I changed the log message from

⚠️ The Parse Server option 'someFeature' default will change to 'true' in a future version.

to

DeprecationWarning: The Parse Server option 'someFeature' default will change to 'true' in a future version.

This is according to the Node.js deprecation warnings and makes it easier so search log files by term DeprecationWarning.

@mtrezza mtrezza mentioned this pull request Mar 29, 2021
6 tasks
@mtrezza
Copy link
Member Author

mtrezza commented Mar 30, 2021

@dplewis If there is no objection, I'll merge this later today.

The coverage change is actually 0%; just with the last commit it seems that cov is reporting false negatives.

@mtrezza mtrezza mentioned this pull request Mar 30, 2021
3 tasks
@mtrezza mtrezza closed this Mar 30, 2021
@mtrezza mtrezza reopened this Mar 30, 2021
@mtrezza mtrezza merged commit 2093d61 into parse-community:master Mar 30, 2021
@mtrezza mtrezza deleted the add-deprecator branch March 30, 2021 20:42
Arul- pushed a commit to Arul-/parse-server that referenced this pull request Apr 1, 2021
* adds deprecator

* un-fit

* added changelog entry

* some fixes

* un-fit

* removed deprecation definition

* changed deprecation log syntax according to Nodejs
@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

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 14, 2022
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.

Add centralized deprecation
3 participants