Mirror: The spec-compliant minimum of client-side GraphQL.

hotfix: Fix aliased field name followed by arguments

Changed files
+7 -1
.changeset
src
+5
.changeset/rotten-lies-camp.md
···
···
+
---
+
'@0no-co/graphql.web': patch
+
---
+
+
Fix aliased field name followed by arguments causing parsing error.
+1 -1
src/__tests__/parser.test.ts
···
expect(() => parse('{ field(name: null }')).toThrow();
expect(() => parse('{ field(name: % )')).toThrow();
-
expect(parse('{ field(name: null) }').definitions[0]).toMatchObject({
kind: Kind.OPERATION_DEFINITION,
selectionSet: {
kind: Kind.SELECTION_SET,
···
expect(() => parse('{ field(name: null }')).toThrow();
expect(() => parse('{ field(name: % )')).toThrow();
+
expect(parse('{ alias: field (name: null) }').definitions[0]).toMatchObject({
kind: Kind.OPERATION_DEFINITION,
selectionSet: {
kind: Kind.SELECTION_SET,
+1
src/parser.ts
···
ignored();
_alias = match;
if ((match = advance(nameRe)) == null) throw error('Field');
}
const _arguments = arguments_(false);
ignored();
···
ignored();
_alias = match;
if ((match = advance(nameRe)) == null) throw error('Field');
+
ignored();
}
const _arguments = arguments_(false);
ignored();