File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1038,16 +1038,28 @@ func parseTypeExtensionDefinition(lexer: Lexer) throws -> TypeExtensionDefinitio
1038
1038
func parseSchemaExtensionDefinition( lexer: Lexer ) throws -> SchemaExtensionDefinition {
1039
1039
let start = lexer. token
1040
1040
try expectKeyword ( lexer: lexer, value: " extend " )
1041
- let description = try parseDescription ( lexer: lexer)
1042
1041
try expectKeyword ( lexer: lexer, value: " schema " )
1043
1042
let directives = try parseDirectives ( lexer: lexer)
1043
+ let operationTypes = try optionalMany (
1044
+ lexer: lexer,
1045
+ openKind: . openingBrace,
1046
+ closeKind: . closingBrace,
1047
+ parse: parseOperationTypeDefinition
1048
+ )
1049
+ if directives. isEmpty, operationTypes. isEmpty {
1050
+ throw syntaxError (
1051
+ source: lexer. source,
1052
+ position: lexer. token. start,
1053
+ description: " expected schema extend to have directive or operation "
1054
+ )
1055
+ }
1044
1056
return SchemaExtensionDefinition (
1045
1057
loc: loc ( lexer: lexer, startToken: start) ,
1046
1058
definition: SchemaDefinition (
1047
1059
loc: loc ( lexer: lexer, startToken: start) ,
1048
- description: description ,
1060
+ description: nil ,
1049
1061
directives: directives,
1050
- operationTypes: [ ]
1062
+ operationTypes: operationTypes
1051
1063
)
1052
1064
)
1053
1065
}
You can’t perform that action at this time.
0 commit comments