server - pedantic fixes

This commit is contained in:
Tobe O 2019-04-24 13:06:14 -04:00
parent e3624c844b
commit b244335c92
7 changed files with 19 additions and 14 deletions

View file

@ -1,3 +1,4 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false

View file

@ -24,7 +24,7 @@ class GraphQL {
GraphQLSchema _schema;
GraphQL(GraphQLSchema schema,
{bool introspect: true,
{bool introspect = true,
this.defaultFieldResolver,
List<GraphQLType> customTypes = const <GraphQLType>[]})
: _schema = schema {
@ -82,7 +82,7 @@ class GraphQL {
Future parseAndExecute(String text,
{String operationName,
sourceUrl,
Map<String, dynamic> variableValues: const {},
Map<String, dynamic> variableValues = const {},
initialValue,
Map<String, dynamic> globalVariables}) {
var tokens = scan(text, sourceUrl: sourceUrl);
@ -109,9 +109,9 @@ class GraphQL {
Future executeRequest(GraphQLSchema schema, DocumentContext document,
{String operationName,
Map<String, dynamic> variableValues: const <String, dynamic>{},
Map<String, dynamic> variableValues = const <String, dynamic>{},
initialValue,
Map<String, dynamic> globalVariables: const <String, dynamic>{}}) async {
Map<String, dynamic> globalVariables = const <String, dynamic>{}}) async {
var operation = getOperation(document, operationName);
var coercedVariableValues = coerceVariableValues(
schema, operation, variableValues ?? <String, dynamic>{});

View file

@ -1,3 +1,4 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'dart:mirrors';
import 'package:angel_serialize/angel_serialize.dart';
import 'package:graphql_schema/graphql_schema.dart';
@ -281,9 +282,9 @@ Exclude _getExclude(Symbol name, MethodMirror mirror) {
String _getSerializedName(Symbol name, MethodMirror mirror, ClassMirror clazz) {
// First search for an @Alias()
for (var obj in mirror.metadata) {
if (obj.reflectee is Alias) {
var alias = obj.reflectee as Alias;
return alias.name;
if (obj.reflectee is SerializableField) {
var alias = obj.reflectee as SerializableField;
return alias.alias;
}
}
@ -304,9 +305,9 @@ String _getSerializedName(Symbol name, MethodMirror mirror, ClassMirror clazz) {
dynamic _getDefaultValue(MethodMirror mirror) {
// Search for a @DefaultValue
for (var obj in mirror.metadata) {
if (obj.reflectee is DefaultValue) {
var ann = obj.reflectee as DefaultValue;
return ann.value;
if (obj.reflectee is SerializableField) {
var ann = obj.reflectee as SerializableField;
return ann.defaultValue;
}
}
@ -317,8 +318,9 @@ bool _autoNames(ClassMirror clazz) {
// Search for a @Serializable()
for (var obj in clazz.metadata) {
if (obj.reflectee is Serializable) {
var ann = obj.reflectee as Serializable;
return ann.autoIdAndDateFields != false;
return true;
// var ann = obj.reflectee as Serializable;
// return ann.autoIdAndDateFields != false;
}
}

View file

@ -17,7 +17,7 @@ abstract class Server {
(msg) async {
if ((msg.type == OperationMessage.gqlConnectionInit) && !_init) {
try {
Map connectionParams = null;
Map connectionParams;
if (msg.payload is Map)
connectionParams = msg.payload as Map;
else if (msg.payload != null)

View file

@ -73,5 +73,5 @@ class GraphQLResult {
final dynamic data;
final Iterable<GraphQLExceptionError> errors;
GraphQLResult(this.data, {this.errors: const []});
GraphQLResult(this.data, {this.errors = const []});
}

View file

@ -15,4 +15,5 @@ dependencies:
stream_channel: ^2.0.0
tuple: ^1.0.0
dev_dependencies:
pedantic: ^1.0.0
test: ">=0.12.0 <2.0.0"

View file

@ -5,6 +5,7 @@ import 'package:test/test.dart';
void main() {
group('convertDartType', () {
group('on enum', () {
// ignore: deprecated_member_use_from_same_package
var type = convertDartType(RomanceLanguage);
var asEnumType = type as GraphQLEnumType;