graphql_generator 1.0.0+1 copy "graphql_generator: ^1.0.0+1" to clipboard
graphql_generator: ^1.0.0+1 copied to clipboard

Generates GraphQL schemas from Dart classes, for use with pkg:graphql_server.

graphql_generator #

Pub build status

Generates package:graphql_schema schemas for annotated class.

Replaces convertDartType from package:graphql_server.

Usage #

Usage is very simple. You just need a @graphQLClass or @GraphQLClass() annotation on any class you want to generate an object type for.

Individual fields can have a @GraphQLDocumentation() annotation, to provide information like descriptions, deprecation reasons, etc.

@graphQLClass
class Todo {
  String text;

  @GraphQLDocumentation(description: 'Whether this item is complete.')
  bool isComplete;
}

void main() {
  print(todoGraphQLType.fields.map((f) => f.name));
}

The following is generated (as of April 18th, 2019):

// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'main.dart';

// **************************************************************************
// _GraphQLGenerator
// **************************************************************************

/// Auto-generated from [Todo].
final GraphQLObjectType todoGraphQLType = objectType('Todo',
    isInterface: false,
    interfaces: [],
    fields: [
      field('text', graphQLString),
      field('isComplete', graphQLBoolean)
    ]);
1
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Generates GraphQL schemas from Dart classes, for use with pkg:graphql_server.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

analyzer, angel_model, angel_serialize_generator, build, build_config, code_builder, graphql_schema, recase, source_gen

More

Packages that depend on graphql_generator