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

Add devAssert about removal of positional arguments #3365

Merged
merged 1 commit into from Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/execution/execute.ts
Expand Up @@ -165,6 +165,12 @@ export interface ExecutionArgs {
* a GraphQLError will be thrown immediately explaining the invalid input.
*/
export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
// Temporary for v15 to v16 migration. Remove in v17
devAssert(
arguments.length < 2,
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
);

const { schema, document, variableValues, rootValue } = args;

// If arguments are missing or incorrect, throw an error.
Expand Down
7 changes: 7 additions & 0 deletions src/execution/subscribe.ts
@@ -1,4 +1,5 @@
import { inspect } from '../jsutils/inspect';
import { devAssert } from '../jsutils/devAssert';
import { isAsyncIterable } from '../jsutils/isAsyncIterable';
import { addPath, pathToArray } from '../jsutils/Path';
import type { Maybe } from '../jsutils/Maybe';
Expand Down Expand Up @@ -51,6 +52,12 @@ import { mapAsyncIterator } from './mapAsyncIterator';
export async function subscribe(
args: ExecutionArgs,
): Promise<AsyncGenerator<ExecutionResult, void, void> | ExecutionResult> {
// Temporary for v15 to v16 migration. Remove in v17
devAssert(
arguments.length < 2,
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
);

const {
schema,
document,
Expand Down
7 changes: 7 additions & 0 deletions src/graphql.ts
@@ -1,4 +1,5 @@
import type { PromiseOrValue } from './jsutils/PromiseOrValue';
import { devAssert } from './jsutils/devAssert';
import { isPromise } from './jsutils/isPromise';
import type { Maybe } from './jsutils/Maybe';

Expand Down Expand Up @@ -90,6 +91,12 @@ export function graphqlSync(args: GraphQLArgs): ExecutionResult {
}

function graphqlImpl(args: GraphQLArgs): PromiseOrValue<ExecutionResult> {
// Temporary for v15 to v16 migration. Remove in v17
devAssert(
arguments.length < 2,
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
);

const {
schema,
source,
Expand Down