Replace snake -> camel

This commit is contained in:
Tobe O 2019-04-25 05:55:23 -04:00
parent f8ba9d220a
commit c2b48ad39e
5 changed files with 12 additions and 9 deletions

View file

@ -1,3 +1,6 @@
# 1.0.0+1
* Replace `snakeCase` with `camelCase`.
# 1.0.0
* Apply `package:pedantic`.

View file

@ -2,7 +2,7 @@ import 'package:graphql_schema/graphql_schema.dart';
part 'main.g.dart';
@graphQLClass
class Todo {
class TodoItem {
String text;
@GraphQLDocumentation(description: 'Whether this item is complete.')
@ -10,5 +10,5 @@ class Todo {
}
void main() {
print(todoGraphQLType.fields.map((f) => f.name));
print(todoItemGraphQLType.fields.map((f) => f.name));
}

View file

@ -6,8 +6,8 @@ part of 'main.dart';
// _GraphQLGenerator
// **************************************************************************
/// Auto-generated from [Todo].
final GraphQLObjectType todoGraphQLType = objectType('Todo',
/// Auto-generated from [TodoItem].
final GraphQLObjectType todoItemGraphQLType = objectType('TodoItem',
isInterface: false,
interfaces: [],
fields: [

View file

@ -64,7 +64,7 @@ class _GraphQLGenerator extends GeneratorForAnnotation<GraphQLClass> {
? c.name.substring(1)
: c.name;
var rc = ReCase(name);
return refer('${rc.snakeCase}GraphQLType');
return refer('${rc.camelCase}GraphQLType');
}
// Next, check if this is the "id" field of a `Model`.
@ -133,7 +133,7 @@ class _GraphQLGenerator extends GeneratorForAnnotation<GraphQLClass> {
args.add(literalConstList(values.map(literalString).toList()));
b
..name = ReCase(clazz.name).snakeCase + 'GraphQLType'
..name = ReCase(clazz.name).camelCase + 'GraphQLType'
..docs.add('/// Auto-generated from [${clazz.name}].')
..type = TypeReference((b) => b
..symbol = 'GraphQLEnumType'
@ -158,7 +158,7 @@ class _GraphQLGenerator extends GeneratorForAnnotation<GraphQLClass> {
? c.name.substring(1)
: c.name;
var rc = ReCase(name);
return refer('${rc.snakeCase}GraphQLType');
return refer('${rc.camelCase}GraphQLType');
});
named['interfaces'] = literalList(interfaces);
@ -221,7 +221,7 @@ class _GraphQLGenerator extends GeneratorForAnnotation<GraphQLClass> {
named['fields'] = literalList(fields);
b
..name = ctx.modelClassNameRecase.snakeCase + 'GraphQLType'
..name = ctx.modelClassNameRecase.camelCase + 'GraphQLType'
..docs.add('/// Auto-generated from [${ctx.modelClassName}].')
..type = refer('GraphQLObjectType')
..modifier = FieldModifier.final$

View file

@ -1,5 +1,5 @@
name: graphql_generator
version: 1.0.0
version: 1.0.0+1
description: Generates GraphQL schemas from Dart classes, for use with pkg:graphql_server.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/graphql