Skip to content

Commit

Permalink
Add devAssert about removal of positional arguments
Browse files Browse the repository at this point in the history
Fixes #3359
  • Loading branch information
IvanGoncharov committed Nov 8, 2021
1 parent 30b4469 commit 311d511
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
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 droped 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 droped 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 droped long-deprecated support for positional arguments, please pass an object instead',
);

const {
schema,
source,
Expand Down

0 comments on commit 311d511

Please sign in to comment.