Ignore tokens named in spec
This commit is contained in:
parent
2256b2afdb
commit
532f698aa2
2 changed files with 18 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
import 'package:string_scanner/string_scanner.dart';
|
||||
|
||||
import 'syntax_error.dart';
|
||||
import 'token.dart';
|
||||
import 'token_type.dart';
|
||||
|
@ -45,7 +46,10 @@ List<Token> scan(String text, {sourceUrl}) {
|
|||
while (!scanner.isDone) {
|
||||
List<Token> potential = [];
|
||||
|
||||
if (scanner.scan(_comment) || scanner.scan(_whitespace)) continue;
|
||||
if (scanner.scan(_comment) ||
|
||||
scanner.scan(_whitespace) ||
|
||||
scanner.scan(',') ||
|
||||
scanner.scan('\ufeff')) continue;
|
||||
|
||||
for (var pattern in _patterns.keys) {
|
||||
if (scanner.matches(pattern)) {
|
||||
|
|
|
@ -215,12 +215,19 @@ class GraphQL {
|
|||
|
||||
for (var field in fields) {
|
||||
var fieldName = field.field.fieldName.name;
|
||||
var fieldType = objectType.fields
|
||||
.firstWhere((f) => f.name == fieldName, orElse: () => null)
|
||||
?.type;
|
||||
if (fieldType == null) continue;
|
||||
var responseValue = await executeField(document, fieldName, objectType,
|
||||
objectValue, fields, fieldType, variableValues);
|
||||
var responseValue;
|
||||
|
||||
if (fieldName == '__typename') {
|
||||
responseValue = objectType.name;
|
||||
} else {
|
||||
var fieldType = objectType.fields
|
||||
.firstWhere((f) => f.name == fieldName, orElse: () => null)
|
||||
?.type;
|
||||
if (fieldType == null) continue;
|
||||
responseValue = await executeField(document, fieldName, objectType,
|
||||
objectValue, fields, fieldType, variableValues);
|
||||
}
|
||||
|
||||
resultMap[responseKey] = responseValue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue