graphql_generator2 6.3.0 copy "graphql_generator2: ^6.3.0" to clipboard
graphql_generator2: ^6.3.0 copied to clipboard

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

Graphql Generator 2 #

Pub Version (including pre-releases) Null Safety Gitter License melos

Generates package:graphql_schema2 schemas for annotated class.

Replaces convertDartType from package:graphql_server2.

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
@GraphQLDocumentation(description: 'Todo object type')
class Todo {
  String text;

  /// Whether this item is complete
  bool isComplete;
}

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

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,
    description: 'Todo object type',
    interfaces: [],
    fields: [
      field('text', graphQLString),
      field('isComplete', graphQLBoolean, description: 'Whether this item is complete')
    ]);
copied to clipboard
0
likes
160
points
309
downloads

Publisher

verified publisherdukefirehawk.com

Weekly Downloads

2024.09.26 - 2025.04.10

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

Homepage
Repository (GitHub)
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

analyzer, angel3_model, angel3_serialize_generator, build, build_config, code_builder, collection, graphql_schema2, recase, source_gen

More

Packages that depend on graphql_generator2