Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
| DEPPS12 | Database option `allowPublicExplain` defaults to `false` | [#7519](https://github.com/parse-community/parse-server/issues/7519) | 8.5.0 (2025) | 9.0.0 (2026) | changed | - |
| DEPPS13 | Config option `enableInsecureAuthAdapters` defaults to `false` | [#9667](https://github.com/parse-community/parse-server/pull/9667) | 8.0.0 (2025) | 9.0.0 (2026) | changed | - |
| DEPPS14 | Config option `pages.encodePageParamHeaders` defaults to `true` | [#10063](https://github.com/parse-community/parse-server/issues/10063) | 9.4.0 (2026) | 10.0.0 (2027) | deprecated | - |
| DEPPS15 | Remove config option `mountPlayground` | [#10110](https://github.com/parse-community/parse-server/issues/10110) | 9.5.0 (2026) | 10.0.0 (2027) | deprecated | - |
| DEPPS16 | Remove config option `playgroundPath` | [#10110](https://github.com/parse-community/parse-server/issues/10110) | 9.5.0 (2026) | 10.0.0 (2027) | deprecated | - |

[i_deprecation]: ## "The version and date of the deprecation."
[i_change]: ## "The version and date of the planned change."
Expand Down
46 changes: 46 additions & 0 deletions spec/Deprecator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,50 @@ describe('Deprecator', () => {
})
);
});

it('logs deprecation for removed key when option is set', async () => {
deprecations = [{ optionKey: 'exampleKey', changeNewKey: '', solution: 'Use something else.' }];

spyOn(Deprecator, '_getDeprecations').and.callFake(() => deprecations);
const logger = require('../lib/logger').logger;
const logSpy = spyOn(logger, 'warn').and.callFake(() => {});

await reconfigureServer({ exampleKey: true });
expect(logSpy).toHaveBeenCalledWith(
`DeprecationWarning: The Parse Server option '${deprecations[0].optionKey}' is deprecated and will be removed in a future version. ${deprecations[0].solution}`
);
});

it('does not log deprecation for removed key when option is not set', async () => {
deprecations = [{ optionKey: 'exampleKey', changeNewKey: '', solution: 'Use something else.' }];

spyOn(Deprecator, '_getDeprecations').and.callFake(() => deprecations);
const logSpy = spyOn(Deprecator, '_logOption').and.callFake(() => {});

await reconfigureServer();
expect(logSpy).not.toHaveBeenCalled();
});

it('logs deprecation for mountPlayground when set', async () => {
const logSpy = spyOn(Deprecator, '_logOption').and.callFake(() => {});

await reconfigureServer({ mountPlayground: true, mountGraphQL: true });
expect(logSpy).toHaveBeenCalledWith(
jasmine.objectContaining({
optionKey: 'mountPlayground',
changeNewKey: '',
})
);
});

it('does not log deprecation for mountPlayground when not set', async () => {
const logSpy = spyOn(Deprecator, '_logOption').and.callFake(() => {});

await reconfigureServer();
expect(logSpy).not.toHaveBeenCalledWith(
jasmine.objectContaining({
optionKey: 'mountPlayground',
})
);
});
});
10 changes: 10 additions & 0 deletions src/Deprecator/Deprecations.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,14 @@ module.exports = [
changeNewDefault: 'true',
solution: "Set 'pages.encodePageParamHeaders' to 'true' to URI-encode non-ASCII characters in page parameter headers.",
},
{
optionKey: 'mountPlayground',
changeNewKey: '',
solution: "Use Parse Dashboard as GraphQL IDE or configure a third-party GraphQL client such as Apollo Sandbox, GraphiQL, or Insomnia with custom request headers.",
},
{
optionKey: 'playgroundPath',
changeNewKey: '',
solution: "Use Parse Dashboard as GraphQL IDE or configure a third-party GraphQL client such as Apollo Sandbox, GraphiQL, or Insomnia with custom request headers.",
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
];
8 changes: 7 additions & 1 deletion src/Deprecator/Deprecator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ class Deprecator {
const solution = deprecation.solution;
const optionKey = deprecation.optionKey;
const changeNewDefault = deprecation.changeNewDefault;
const changeNewKey = deprecation.changeNewKey;

// If default will change, only throw a warning if option is not set
if (changeNewDefault != null && Utils.getNestedProperty(options, optionKey) == null) {
Deprecator._logOption({ optionKey, changeNewDefault, solution });
}

// If key will be removed or renamed, only throw a warning if option is set
if (changeNewKey != null && Utils.getNestedProperty(options, optionKey) != null) {
Deprecator._logOption({ optionKey, changeNewKey, solution });
}
}
}

Expand Down Expand Up @@ -107,7 +113,7 @@ class Deprecator {

// Compose message
let output = `DeprecationWarning: The Parse Server ${type} '${key}' `;
output += changeNewKey ? `is deprecated and will be ${keyAction} in a future version.` : '';
output += changeNewKey != null ? `is deprecated and will be ${keyAction} in a future version.` : '';
output += changeNewDefault
? `default will change to '${changeNewDefault}' in a future version.`
: '';
Expand Down
4 changes: 2 additions & 2 deletions src/Options/Definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ module.exports.ParseServerOptions = {
},
mountPlayground: {
env: 'PARSE_SERVER_MOUNT_PLAYGROUND',
help: 'Mounts the GraphQL Playground which exposes the master key in the browser - never use this option in production',
help: 'Deprecated. Mounts the GraphQL Playground which is deprecated and will be removed in a future version. The playground exposes the master key in the browser. Use Parse Dashboard as GraphQL IDE or configure a third-party GraphQL client with custom request headers.',
action: parsers.booleanParser,
default: false,
},
Expand All @@ -429,7 +429,7 @@ module.exports.ParseServerOptions = {
},
playgroundPath: {
env: 'PARSE_SERVER_PLAYGROUND_PATH',
help: 'Mount path for the GraphQL Playground, defaults to /playground',
help: 'Deprecated. Mount path for the GraphQL Playground. The playground is deprecated and will be removed in a future version.',
default: '/playground',
},
port: {
Expand Down
4 changes: 2 additions & 2 deletions src/Options/docs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ export interface ParseServerOptions {
:ENV: PARSE_SERVER_GRAPHQL_PUBLIC_INTROSPECTION
:DEFAULT: false */
graphQLPublicIntrospection: ?boolean;
/* Mounts the GraphQL Playground which exposes the master key in the browser - never use this option in production
/* Deprecated. Mounts the GraphQL Playground which is deprecated and will be removed in a future version. The playground exposes the master key in the browser. Use Parse Dashboard as GraphQL IDE or configure a third-party GraphQL client with custom request headers.
:ENV: PARSE_SERVER_MOUNT_PLAYGROUND
:DEFAULT: false */
mountPlayground: ?boolean;
/* Mount path for the GraphQL Playground, defaults to /playground
/* Deprecated. Mount path for the GraphQL Playground. The playground is deprecated and will be removed in a future version.
:ENV: PARSE_SERVER_PLAYGROUND_PATH
Comment thread
coderabbitai[bot] marked this conversation as resolved.
:DEFAULT: /playground */
playgroundPath: ?string;
Expand Down
2 changes: 1 addition & 1 deletion src/ParseServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class ParseServer {
if (options.mountPlayground) {
parseGraphQLServer.applyPlayground(app);
logging.getLogger().warn(
'GraphQL Playground is enabled and exposes the master key in the browser. The playground is a developer tool and should not be used in production. Use Parse Dashboard for production environments.'
'GraphQL Playground is deprecated and will be removed in a future version. It exposes the master key in the browser. Use Parse Dashboard as GraphQL IDE or configure a third-party GraphQL client with custom request headers.'
);
}
}
Expand Down
Loading