[][src]Crate async_graphql

A GraphQL server library implemented in Rust

Crates.io version Download docs.rs docs

Documentation

Features

  • Fully supports async/await
  • Type safety
  • Rustfmt friendly (Procedural Macro)
  • Custom scalars
  • Minimal overhead
  • Easy integration (actix_web, tide, warp, rocket ...)
  • File upload (Multipart request)
  • Subscriptions (WebSocket transport)
  • Custom extensions
  • Apollo Tracing extension
  • Limit query complexity/depth
  • Error Extensions
  • Apollo Federation
  • Batch Queries
  • Apollo Persisted Queries

Crate features

This crate offers the following features, all of which are activated by default:

Integrations

License

Licensed under either of

References

Examples

If you are just getting started, we recommend checking out our examples at: https://github.com/async-graphql/examples

To see how you would create a Relay-compliant server using async-graphql, warp, diesel & postgresql, you can also check out a real-world example at: https://github.com/phated/twentyfive-stars

Benchmarks

Ensure that there is no CPU-heavy process in background!

cd benchmark
cargo bench

Now a HTML report is available at benchmark/target/criterion/report.

Re-exports

pub use async_graphql_parser as parser;
pub use parser::Pos;
pub use parser::Positioned;
pub use types::*;

Modules

extensions

Extensions for schema

guard

Field guards

http

A helper module that supports HTTP

resolver_utils

Utilities for implementing OutputValueType::resolve.

types

Useful GraphQL types.

validators

Input value validators

Macros

value

Structs

CacheControl

Cache control values

ContextBase

Query context

Data

Schema/Context data.

Error

An error with a message and optional extensions.

ErrorExtensionValues

Extensions to the error.

InputValueError

An error parsing an input value.

Lookahead

A selection performed by a query.

Name
Number
QueryPathNode

The query path node

Request

GraphQL request.

ResolveId

Represents the unique id of the resolve

Response

Query response

Schema

GraphQL schema.

SchemaBuilder

Schema builder

ServerError

An error in a GraphQL server.

Variables

Variables of a query.

Enums

BatchRequest

Batch support for GraphQL requests, which is either a single query, or an array of queries

BatchResponse

Response for batchable queries

DeserializerError
ParseRequestError

An error parsing the request.

PathSegment

A segment of path to a resolver.

QueryPathSegment

The query path segment

SerializerError
ValidationMode

Validation mode

Value

Traits

ContainerType

A GraphQL container.

EnumType

A GraphQL enum.

ErrorExtensions

An error which can be extended into a FieldError.

InputObjectType

A GraphQL input object.

InputValueType

Represents a GraphQL input value

InterfaceType

A GraphQL interface.

ObjectType

A GraphQL object.

OutputValueType

Represents a GraphQL output value

ResultExt

Extend a Result's error value with ErrorExtensions.

ScalarType

A GraphQL scalar.

Type

Represents a GraphQL type

UnionType

A GraphQL interface.

Functions

from_value
to_value

Type Definitions

Context

Context object for resolve field

InputValueResult

An error parsing a value of type T.

Result

An alias for Result<T, Error>.

ServerResult

Alias for Result<T, ServerError>.

Attribute Macros

Object
Scalar
Subscription

Derive Macros

Enum
InputObject
Interface
MergedObject
MergedSubscription
SimpleObject
Union