Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Libraries supporting GraphQL in Dart

License

NotificationsYou must be signed in to change notification settings

gql-dart/gql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT LicensePRs WelcomeWatch on GitHubStar on GitHubWatch on GitHubDiscord

This is an effort to advance the Dart GraphQL ecosystem.

It consists of multiple packages and libraries centered around GraphQL AST.

Packages

Core

The core of this project is the GraphQL parser which parses GraphQL strings into an AST. The parsed AST can then be transformed, visited and printed back to GraphQL string.

PubPackageLibraryDescription
versionpackage:gqlast.dartGraphQL AST implementation with Visitor pattern and AST transformer
versionpackage:gqllanguage.dartGraphQL source parser and printer. Recognizes both operations and SDL
versionpackage:gqldocument.dartDocument and schema validation

Code generation

GraphQL language enables code generation to speed up development and move document processing to build-time.

We provide code builders to generate Dart source code and file builders which easily plug into standard Dart code generation pipeline.

Ideas for future work:

  • Typed resolvers for field resolution on the client or server
PubPackageLibraryDescription
versionpackage:gql_code_builderVarious builders
versionpackage:gql_buildFile builders

Client

To enable development of GraphQL clients, we provide type definitions used to execute GraphQL operations. They include AST-based operation, request with per operation context, and response. These types are used by the Links.

Link is the current client implementation. Link is GraphQL AST-aware request/response middleware. They can be used to build a pipeline to deduplicate requests, conditionally transform requests and responses (including the context), and eventually send the requests to the server.

Ideas for future work:

  • websocket link for subscriptions
  • batched request HTTP link
  • retry link to handle network issues transparently
  • link for client-side request resolution
PubPackageLibraryDescription
versionpackage:gql_execgql_exec.dartImplementation of types for GraphQL requests and responses
versionpackage:gql_linklink.dartBase for modular GraphQL execution interface
versionpackage:gql_http_linkgql_http_link.dartLink to execute GraphQL requests via HTTP
versionpackage:gql_dedupe_linkgql_dedupe_link.dartDe-duplicating Link to avoid execution of identical requests
versionpackage:gql_transform_linkgql_transform_link.dartGQL Link to transform Requests and Responses. May be used to update context, document, variables, data, errors, etc.
versionpackage:gql_websocket_linkgql_websocket_link.dartGQL Link for subscriptions using websocket.
versionpackage:gql_dio_linkgql_dio_link.dartSimilar to gql_http_link, A GQL Terminating Link to execute requests via Dio using JSON.

Other

PubPackageLibraryDescription
versionpackage:gql_pedanticLint rules used by allgql-dart/gql packages

Examples

PubPackageLibraryDescription
versionpackage:gql_example_cliExample usage in a CLI environment
versionpackage:gql_example_flutterExample usage in a Flutter environment

Users

ProjectDescription
artemisBuild dart types from GraphQL schemas and queries (using Introspection Query).
graphqlA stand-alone GraphQL client for Dart, bringing all the features from a modern GraphQL client to one easy to use package.
graphql_flutterA GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
normalizeNormalization and denormalization of GraphQL responses in Dart
ferryGraphQL Client for Dart
Your project?Open a PR to add it to this readme!

Contributing

The goal of this project is to expand Dart GraphQL ecosystemand to build a community around this vendor-neutral implementation.

Community contributions are welcome.

Release Process

This repository usesMelos to manage the monorepo and handle releases. The release process is partially automated through GitHub Actions.

Repository Structure

The repository is organized into several package categories:

  • Core packages:

    • gql: Core GraphQL package
    • gql_tristate_value
    • gql_code_builder_serializers
    • gql_code_builder
  • Execution packages:

    • gql_exec
    • gql_link
  • Link implementations:

    • gql_http_link
    • gql_dio_link
    • gql_websocket_link
    • gql_dedupe_link
    • gql_error_link
    • gql_transform_link
  • Build packages:

    • gql_build

Local Development

To get started with local development:

  1. Install Melos:

    dart pub global activate melos&& dart pub get
  2. Bootstrap the workspace:

    melos bootstrap
  3. Run tests:

    melostest

Release Process

Automated Publishing

The publish workflow is automated via GitHub Actions and triggers when:

  • Changes are pushed to themaster orrelease branches AND include changes to anypubspec.yaml file
  • Manually triggered through GitHub Actions UI

The automated process:

  1. Validates all packages (formatting, analysis, and tests)
  2. Publishes packages in dependency order:
    • Core packages first
    • Execution packages second
    • Link implementation packages third
    • Build packages last

Manual Release Steps

To create a new release manually:

  1. Ensure you're on the branch you want to release from (master orrelease)

  2. Version the packages using one of the following commands:

    # For a patch releasemelos run bump-patch# For a minor releasemelos run bump-minor# For a major releasemelos run bump-major# For an alpha releasemelos run bump-alpha# To graduate from prerelease(alpha) to stablemelos run graduate
  3. Push the changes and tags:

    git push&& git push --tags
  4. The GitHub Action will automatically handle publishing to pub.dev if changes include pubspec.yaml files

Versioning Rules

  • Usebump-patch for backward-compatible bug fixes
  • Usebump-minor for backward-compatible features
  • Usebump-major for breaking changes
  • Usebump-alpha for prerelease versions
  • Usegraduate to promote prerelease versions to stable

Available Melos Commands

  • melos bootstrap: Set up the workspace
  • melos clean: Clean all packages
  • melos test: Run tests for all packages
  • melos format: Format all packages
  • melos analyze: Run static analysis
  • melos build: Run build_runner for all packages
  • melos publish: Publish packages to pub.dev

Troubleshooting

If the automated publish fails:

  1. Check the GitHub Actions logs for specific errors
  2. Ensure all tests are passing locally:melos test
  3. Verify that version numbers inpubspec.yaml files are correct
  4. Check that all dependencies are properly versioned

For manual publishing (if needed, requires pub dev authentication):

melos publish --no-dry-run --yes --scope="package_name"

Notes

  • The publish workflow publishes packages in a specific order to handle dependencies correctly
  • All packages are versioned together to maintain consistency
  • The workflow automatically handles pub.dev credentials through GitHub Secrets
  • Changes topubspec.yaml files automatically trigger the publish workflow

Features and bugs

Please file feature requests and bugs at theGitHub.


[8]ページ先頭

©2009-2025 Movatter.jp