gql_build 0.11.1-alpha+1706372327836 copy "gql_build: ^0.11.1-alpha+1706372327836" to clipboard
gql_build: ^0.11.1-alpha+1706372327836 copied to clipboard

Useful builders for your GraphQL SDL and documents. Based on package:gql_code_builder and package:build

MIT License PRs Welcome Watch on GitHub Star on GitHub Watch on GitHub Discord

A package for Dart code generation from GraphQL source.

Builders in this package let you build your GraphQL requests and view the response in a type-safe way.

Usage example #

See the gql_example_cli or gql_example_flutter for usage examples.

Provided builders #

ast_builder #

Generates an AST representation of a GraphQL Document

data_builder #

Generates a typed view of your data.

var_builder #

Creates data classes for any GraphQL variables used in a query or fragment.

Configuration

tristate_optionals: [bool] Whether to wrap nullable fields in a Value class in order to distinguish between three cases:

  • absent
  • null
  • non-null value

Example:


        tristate_optionals: true 

schema_builder #

Creates data classes from your specified graphql schema.

Configuration

type_overrides: [Map] Specify how scalar types should be serialized

Example:

type_overrides:
    CustomStringScalar:
      name: String
    CustomField:
       name: CustomField
       import: 'package:mypackage/custom_field.dart'

enum_fallbacks: [Map] Specify fallback values to enum values in order to not break the serializer when new enum values are added to the schema and the client has not updated to the new schema yet.

global_enum_fallbacks: [bool] Add a generated fallback value for each enum value (except for ones that have a custom fallback value specified in the enum_fallbacks map). Defaults to false.

Example:

global_enum_fallbacks: true # add a generated fallback value to all enums
enum_fallbacks:
    MyEnumType: OTHER   # except for the type 'MyEnumType', use the value 'OTHER' as fallback there

tristate_optionals: [bool] Whether to wrap nullable fields in input types in a Value class in order distinguish between three cases:

  • absent
  • null
  • non-null value

Example:

tristate_optionals: true

serializer_builder #

Creates built_value serializers for each built_value class.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

15
likes
0
pub points
84%
popularity

Publisher

verified publishergql-dart.dev

Useful builders for your GraphQL SDL and documents. Based on package:gql_code_builder and package:build

Repository (GitHub)
View/report issues

Topics

#graphql #gql #codegen

License

unknown (license)

Dependencies

analyzer, build, built_collection, built_value, built_value_generator, code_builder, dart_style, glob, gql, gql_code_builder, gql_tristate_value, path, yaml

More

Packages that depend on gql_build