Skip to content

Commit 8feed9c

Browse files
committed
Accept kitchen-sink.graphql again (type conditions on inline fragments are optional)
1 parent f9a84e5 commit 8feed9c

File tree

5 files changed

+248
-232
lines changed

5 files changed

+248
-232
lines changed

JsonVisitor.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,12 @@ void JsonVisitor::endVisitInlineFragment(const InlineFragment &inlineFragment) {
259259

260260
const auto &children = printed_.back();
261261

262-
out_ << "\"typeCondition\":" << children[0];
262+
auto nextChild = children.begin();
263+
if (inlineFragment.getTypeCondition() != nullptr) {
264+
out_ << "\"typeCondition\":" << *nextChild++;
265+
}
263266

264267
out_ << ",\"directives\":";
265-
auto nextChild = children.begin() + 1;
266268
const auto *directives = inlineFragment.getDirectives();
267269
if (directives != nullptr) {
268270
printChildArray(nextChild, directives->size());

ast/ast.ast

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ S Name name
5151
P? Directive directives
5252

5353
T InlineFragment
54-
S NamedType typeCondition
54+
S? NamedType typeCondition
5555
P? Directive directives
5656
S SelectionSet selectionSet
5757

0 commit comments

Comments
 (0)