Skip to content

Commit ac7b5f2

Browse files
fix(parser): object values can be empty, fixes #744 (#745)
* fix(parser): object values can be empty, fixes #744 * spaces * changelog * links
1 parent 0960e58 commit ac7b5f2

File tree

4 files changed

+123
-85
lines changed

4 files changed

+123
-85
lines changed

crates/apollo-parser/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3838
[issue/715]: https://github.com/apollographql/apollo-rs/issues/715
3939
[fieldtype]: https://specs.apollo.dev/join/v0.3/#@field
4040

41+
## Fixes
42+
43+
- **Input object values can be empty - [goto-bus-stop], [pull/745] fixing [issue/744]**
44+
`apollo-parser` version 0.7.3 introduced a regression where empty input objects failed to parse.
45+
This is now fixed.
46+
47+
```graphql
48+
{ field(argument: {}) }
49+
```
50+
51+
[goto-bus-stop]: https://github.com/goto-bus-stop
52+
[pull/745]: https://github.com/apollographql/apollo-rs/pull/745
53+
[issue/744]: https://github.com/apollographql/apollo-rs/issues/744
54+
4155
# [0.7.3](https://crates.io/crates/apollo-parser/0.7.3) - 2023-11-07
4256

4357
## Fixes

crates/apollo-parser/src/parser/grammar/value.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ pub(crate) fn object_value(p: &mut Parser) {
110110
let _g = p.start_node(SyntaxKind::OBJECT_VALUE);
111111
p.bump(S!['{']);
112112

113-
if let Some(TokenKind::Name) = p.peek() {
114-
object_field(p);
115-
} else {
116-
p.err("expected Object Value");
117-
}
118113
while let Some(TokenKind::Name) = p.peek() {
119114
object_field(p);
120115
}
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
user(id: 4, size: $size value: "string", input: [ "one", 1.34 ], otherInput: { key: false, output: null })
3-
}
2+
user(
3+
id: 4,
4+
size: $size
5+
value: "string",
6+
input: [ "one", 1.34 ],
7+
otherInput: { key: false, output: null }
8+
emptyList: []
9+
emptyObject: {}
10+
)
11+
}
Lines changed: 99 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,107 @@
1-
- DOCUMENT@0..114
2-
- OPERATION_DEFINITION@0..114
3-
- SELECTION_SET@0..114
1+
- DOCUMENT@0..207
2+
- OPERATION_DEFINITION@0..206
3+
- SELECTION_SET@0..206
44
55
6-
- FIELD@6..112
6+
- FIELD@6..204
77
88
9-
- ARGUMENTS@10..112
9+
- ARGUMENTS@10..204
1010
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
11+
12+
13+
14+
2315
2416
25-
26-
27-
28-
29-
30-
31-
32-
33-
34-
35-
36-
- [email protected] "\"string\""
37-
38-
39-
40-
41-
42-
43-
44-
45-
46-
47-
48-
- [email protected] "\"one\""
49-
50-
51-
52-
53-
54-
55-
56-
57-
58-
59-
- [email protected] "otherInput"
60-
61-
62-
63-
64-
65-
66-
67-
68-
69-
70-
71-
72-
73-
74-
75-
76-
- [email protected] "output"
77-
78-
79-
80-
81-
82-
83-
84-
85-
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
- [email protected] "\"string\""
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
- [email protected] "\"one\""
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
- [email protected] "otherInput"
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
- [email protected] "output"
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
- [email protected] "emptyList"
88+
89+
90+
91+
92+
93+
94+
95+
96+
- [email protected] "emptyObject"
97+
98+
99+
100+
101+
102+
103+
104+
105+
106+
86107
recursion limit: 500, high: 2

0 commit comments

Comments
 (0)