Skip to content

Commit

Permalink
hotfix: Fix aliased field name followed by arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Apr 2, 2024
1 parent a625879 commit 65c73a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rotten-lies-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphql.web': patch
---

Fix aliased field name followed by arguments causing parsing error.
2 changes: 1 addition & 1 deletion src/__tests__/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('parse', () => {
expect(() => parse('{ field(name: null }')).toThrow();
expect(() => parse('{ field(name: % )')).toThrow();

expect(parse('{ field(name: null) }').definitions[0]).toMatchObject({
expect(parse('{ alias: field (name: null) }').definitions[0]).toMatchObject({
kind: Kind.OPERATION_DEFINITION,
selectionSet: {
kind: Kind.SELECTION_SET,
Expand Down
1 change: 1 addition & 0 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ function selectionSet(): ast.SelectionSetNode {
ignored();
_alias = match;
if ((match = advance(nameRe)) == null) throw error('Field');
ignored();
}
const _arguments = arguments_(false);
ignored();
Expand Down

0 comments on commit 65c73a0

Please sign in to comment.