Skip to content

feat: add GraphQL server config options #7940

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

Open
wants to merge 28 commits into
base: alpha
Choose a base branch
from

Conversation

tstachl
Copy link

@tstachl tstachl commented Apr 15, 2022

New Pull Request Checklist

Issue Description

This pull request adds GraphQL config options to the CLI.

Related issue: #7939

Approach

TODOs before merging

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK
  • A changelog entry is created automatically using the pull request title (do not manually add a changelog entry)

mtrezza and others added 22 commits March 25, 2022 19:47
## [5.2.1-alpha.1](parse-community/parse-server@5.2.0...5.2.1-alpha.1) (2022-03-26)

### Bug Fixes

* return correct response when revert is used in beforeSave ([parse-community#7839](parse-community#7839)) ([f63fb2b](parse-community@f63fb2b))
## [5.2.1-alpha.2](parse-community/parse-server@5.2.1-alpha.1...5.2.1-alpha.2) (2022-03-26)

### Performance Improvements

* reduce database operations when using the constant parameter in Cloud Function validation ([parse-community#7892](parse-community#7892)) ([48bd512](parse-community@48bd512))
# [5.3.0-alpha.2](parse-community/parse-server@5.3.0-alpha.1...5.3.0-alpha.2) (2022-03-27)

### Bug Fixes

* security upgrade parse push adapter from 4.1.0 to 4.1.2 ([parse-community#7893](parse-community#7893)) ([ef56e98](parse-community@ef56e98))
# [5.3.0-alpha.4](parse-community/parse-server@5.3.0-alpha.3...5.3.0-alpha.4) (2022-04-04)

### Bug Fixes

* custom database options are not passed to MongoDB GridFS ([parse-community#7911](parse-community#7911)) ([a72b384](parse-community@a72b384))
# [5.3.0-alpha.6](parse-community/parse-server@5.3.0-alpha.5...5.3.0-alpha.6) (2022-04-11)

### Bug Fixes

* peer dependency mismatch for GraphQL dependencies ([parse-community#7934](parse-community#7934)) ([b7a1d76](parse-community@b7a1d76))
@parse-github-assistant
Copy link

parse-github-assistant bot commented Apr 15, 2022

Thanks for opening this pull request!

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

@tstachl tstachl reopened this Apr 15, 2022
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.

Could you add any test cases for when using the new option?

@mtrezza mtrezza changed the title adding graphQLConfig to CLI options feat: add GraphQL server config options Apr 15, 2022
@tstachl
Copy link
Author

tstachl commented Apr 16, 2022

@mtrezza added some test cases, couldn't find a good example of a test case for the option so I reused the output logic from another test case.

@codecov
Copy link

codecov bot commented Apr 17, 2022

Codecov Report

Merging #7940 (0b8b3bd) into alpha (b45d44e) will increase coverage by 0.32%.
The diff coverage is 69.23%.

@@            Coverage Diff             @@
##            alpha    #7940      +/-   ##
==========================================
+ Coverage   93.80%   94.12%   +0.32%     
==========================================
  Files         182      182              
  Lines       13629    13642      +13     
==========================================
+ Hits        12785    12841      +56     
+ Misses        844      801      -43     
Impacted Files Coverage Δ
src/Options/index.js 100.00% <ø> (ø)
src/Config.js 87.95% <60.00%> (-1.06%) ⬇️
src/Options/Definitions.js 100.00% <100.00%> (ø)
src/ParseServer.js 90.16% <100.00%> (+0.10%) ⬆️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 95.46% <0.00%> (+0.07%) ⬆️
src/RestWrite.js 94.46% <0.00%> (+0.15%) ⬆️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 93.16% <0.00%> (+0.21%) ⬆️
src/ParseServerRESTController.js 98.48% <0.00%> (+1.51%) ⬆️
src/Adapters/Cache/RedisCacheAdapter.js 87.71% <0.00%> (+75.43%) ⬆️

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 b45d44e...0b8b3bd. Read the comment docs.

@mtrezza mtrezza requested a review from a team April 17, 2022 11:40
static validateGraphqlConfig(graphqlConfig: GraphqlConfig) {
if (!graphqlConfig) return;
if (Object.prototype.toString.call(graphqlConfig) !== '[object Object]') {
throw 'Parse Server option graphqlConfig must be an object.';
Copy link
Member

Choose a reason for hiding this comment

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

Here codecov report that errors are not covered, I'll suggest covering errors, it could help developers to debug a wrong graphql config.

It's not a request change, feel free to cover errors @tstachl

@mtrezza what do you think ?

Copy link
Member

Choose a reason for hiding this comment

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

otherwise LGTM

Copy link
Member

Choose a reason for hiding this comment

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

Yes, should be an easy one, just copy/paste another test.

@mtrezza mtrezza force-pushed the alpha branch 2 times, most recently from 59215e6 to e6d7d8f Compare May 1, 2022 02:29
@Moumouls
Copy link
Member

Moumouls commented Jun 8, 2022

@tstachl feel free to rebase on alpha and cover the validateGraphqlConfig with a dedicated test, then we should be close to the merge 🚀

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.

7 participants