Update all links to October 2021 spec (#1075, #1000)

Co-authored-by: Kai Ren <tyranron@gmail.com>
This commit is contained in:
ilslv 2022-06-28 18:32:08 +03:00 committed by GitHub
parent 927e42201a
commit a32140cd46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 286 additions and 286 deletions

View file

@ -47,7 +47,7 @@ see the [actix][actix_examples], [hyper][hyper_examples], [rocket][rocket_exampl
## Features ## Features
Juniper supports the full GraphQL query language according to the Juniper supports the full GraphQL query language according to the
[specification][graphql_spec], including interfaces, unions, schema [specification (October 2021)][graphql_spec], including interfaces, unions, schema
introspection, and validations. It can also output the schema in the [GraphQL Schema Language][schema_language]. introspection, and validations. It can also output the schema in the [GraphQL Schema Language][schema_language].
As an exception to other GraphQL libraries for other languages, Juniper builds As an exception to other GraphQL libraries for other languages, Juniper builds
@ -97,7 +97,7 @@ Juniper has not reached 1.0 yet, thus some API instability should be expected.
[graphiql]: https://github.com/graphql/graphiql [graphiql]: https://github.com/graphql/graphiql
[playground]: https://github.com/prisma/graphql-playground [playground]: https://github.com/prisma/graphql-playground
[iron]: https://github.com/iron/iron [iron]: https://github.com/iron/iron
[graphql_spec]: http://facebook.github.io/graphql [graphql_spec]: https://spec.graphql.org/October2021
[schema_language]: https://graphql.org/learn/schema/#type-language [schema_language]: https://graphql.org/learn/schema/#type-language
[schema_approach]: https://blog.logrocket.com/code-first-vs-schema-first-development-graphql/ [schema_approach]: https://blog.logrocket.com/code-first-vs-schema-first-development-graphql/
[test_schema_rs]: https://github.com/graphql-rust/juniper/blob/master/juniper/src/tests/fixtures/starwars/schema.rs [test_schema_rs]: https://github.com/graphql-rust/juniper/blob/master/juniper/src/tests/fixtures/starwars/schema.rs

View file

@ -21,7 +21,7 @@ embedded [Graphiql][graphiql] for easy debugging.
## Features ## Features
Juniper supports the full GraphQL query language according to the Juniper supports the full GraphQL query language according to the
[specification][graphql_spec], including interfaces, unions, schema [specification (October 2021)][graphql_spec], including interfaces, unions, schema
introspection, and validations. introspection, and validations.
It does not, however, support the schema language. It does not, however, support the schema language.
@ -57,7 +57,7 @@ Juniper has not reached 1.0 yet, thus some API instability should be expected.
[graphql]: http://graphql.org [graphql]: http://graphql.org
[graphiql]: https://github.com/graphql/graphiql [graphiql]: https://github.com/graphql/graphiql
[iron]: https://github.com/iron/iron [iron]: https://github.com/iron/iron
[graphql_spec]: http://facebook.github.io/graphql [graphql_spec]: https://spec.graphql.org/October2021
[test_schema_rs]: https://github.com/graphql-rust/juniper/blob/master/juniper/src/tests/schema.rs [test_schema_rs]: https://github.com/graphql-rust/juniper/blob/master/juniper/src/tests/schema.rs
[tokio]: https://github.com/tokio-rs/tokio [tokio]: https://github.com/tokio-rs/tokio
[hyper_examples]: https://github.com/graphql-rust/juniper/tree/master/juniper_hyper/examples [hyper_examples]: https://github.com/graphql-rust/juniper/tree/master/juniper_hyper/examples

View file

@ -473,9 +473,9 @@ struct Droid {
[1]: https://spec.graphql.org/June2018/#sec-Interfaces [1]: https://spec.graphql.org/October2021#sec-Interfaces
[2]: https://doc.rust-lang.org/reference/types/trait-object.html [2]: https://doc.rust-lang.org/reference/types/trait-object.html
[3]: https://docs.rs/juniper/latest/juniper/trait.ScalarValue.html [3]: https://docs.rs/juniper/latest/juniper/trait.ScalarValue.html
[4]: https://docs.rs/juniper/latest/juniper/struct.Executor.html [4]: https://docs.rs/juniper/latest/juniper/struct.Executor.html
[5]: https://spec.graphql.org/June2018/#sec-Objects [5]: https://spec.graphql.org/October2021#sec-Objects
[6]: https://docs.rs/juniper/0.14.2/juniper/trait.Context.html [6]: https://docs.rs/juniper/0.14.2/juniper/trait.Context.html

View file

@ -60,7 +60,7 @@ there - those errors are automatically converted into `FieldError`.
## Error payloads, `null`, and partial errors ## Error payloads, `null`, and partial errors
Juniper's error behavior conforms to the [GraphQL specification](https://spec.graphql.org/June2018/#sec-Errors-and-Non-Nullability). Juniper's error behavior conforms to the [GraphQL specification](https://spec.graphql.org/October2021#sec-Handling-Field-Errors).
When a field returns an error, the field's result is replaced by `null`, an When a field returns an error, the field's result is replaced by `null`, an
additional `errors` object is created at the top level of the response, and the additional `errors` object is created at the top level of the response, and the
@ -168,7 +168,7 @@ impl Example {
# fn main() {} # fn main() {}
``` ```
The specified structured error information is included in the [`extensions`](https://facebook.github.io/graphql/June2018/#sec-Errors) key: The specified structured error information is included in the [`extensions`](https://spec.graphql.org/October2021#sec-Errors) key:
```json ```json
{ {

View file

@ -24,10 +24,10 @@ Juniper has built-in support for:
* `String` and `&str` as `String` * `String` and `&str` as `String`
* `bool` as `Boolean` * `bool` as `Boolean`
* `juniper::ID` as `ID`. This type is defined [in the * `juniper::ID` as `ID`. This type is defined [in the
spec](http://facebook.github.io/graphql/#sec-ID) as a type that is serialized spec](https://spec.graphql.org/October2021#sec-ID) as a type that is serialized
as a string but can be parsed from both a string and an integer. as a string but can be parsed from both a string and an integer.
Note that there is no built-in support for `i64`/`u64`, as the GraphQL spec [doesn't define any built-in scalars for `i64`/`u64` by default](https://spec.graphql.org/June2018/#sec-Int). You may wish to leverage a [custom GraphQL scalar](#custom-scalars) in your schema to support them. Note that there is no built-in support for `i64`/`u64`, as the GraphQL spec [doesn't define any built-in scalars for `i64`/`u64` by default](https://spec.graphql.org/October2021#sec-Int). You may wish to leverage a [custom GraphQL scalar](#custom-scalars) in your schema to support them.
**Third party types**: **Third party types**:

View file

@ -130,7 +130,7 @@ impl Character {
# fn main() {} # fn main() {}
``` ```
With an external resolver function we can even declare a new [GraphQL union][1] variant where the Rust type is absent in the initial enum definition. The attribute syntax `#[graphql(on VariantType = resolver_fn)]` follows the [GraphQL syntax for dispatching union variants](https://spec.graphql.org/June2018/#example-f8163). With an external resolver function we can even declare a new [GraphQL union][1] variant where the Rust type is absent in the initial enum definition. The attribute syntax `#[graphql(on VariantType = resolver_fn)]` follows the [GraphQL syntax for dispatching union variants](https://spec.graphql.org/October2021#example-f8163).
```rust ```rust
# #![allow(dead_code)] # #![allow(dead_code)]
@ -485,7 +485,7 @@ enum Character {
[1]: https://spec.graphql.org/June2018/#sec-Unions [1]: https://spec.graphql.org/October2021#sec-Unions
[2]: https://docs.rs/juniper/latest/juniper/trait.ScalarValue.html [2]: https://docs.rs/juniper/latest/juniper/trait.ScalarValue.html
[5]: https://spec.graphql.org/June2018/#sec-Interfaces [5]: https://spec.graphql.org/October2021#sec-Interfaces
[6]: https://docs.rs/juniper/0.14.2/juniper/trait.Context.html [6]: https://docs.rs/juniper/0.14.2/juniper/trait.Context.html

View file

@ -405,7 +405,7 @@ impl<'a, S> MetaType<'a, S> {
// "used exclusively by GraphQLs introspection system" // "used exclusively by GraphQLs introspection system"
{ {
name.starts_with("__") || name.starts_with("__") ||
// <https://facebook.github.io/graphql/draft/#sec-Scalars> // https://spec.graphql.org/October2021#sec-Scalars
name == "Boolean" || name == "String" || name == "Int" || name == "Float" || name == "ID" || name == "Boolean" || name == "String" || name == "Int" || name == "Float" || name == "ID" ||
// Our custom empty markers // Our custom empty markers
name == "_EmptyMutation" || name == "_EmptySubscription" name == "_EmptyMutation" || name == "_EmptySubscription"

View file

@ -298,9 +298,9 @@ where
} }
} }
// Right now the only directive supported is `@deprecated`. `@skip` and `@include` // Right now the only directive supported is `@deprecated`.
// are dealt with elsewhere. // `@skip` and `@include` are dealt with elsewhere.
// <https://facebook.github.io/graphql/draft/#sec-Type-System.Directives> // https://spec.graphql.org/October2021#sec-Type-System.Directives.Built-in-Directives
fn generate_directives<'a, T>(status: &DeprecationStatus) -> Vec<ExternalDirective<'a, T>> fn generate_directives<'a, T>(status: &DeprecationStatus) -> Vec<ExternalDirective<'a, T>>
where where
T: Text<'a>, T: Text<'a>,

View file

@ -30,7 +30,7 @@ where
/// ///
/// The default implementation panics. /// The default implementation panics.
/// ///
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
fn resolve_field_async<'a>( fn resolve_field_async<'a>(
&'a self, &'a self,
_info: &'a Self::TypeInfo, _info: &'a Self::TypeInfo,
@ -54,9 +54,9 @@ where
/// ///
/// The default implementation panics. /// The default implementation panics.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Unions /// [2]: https://spec.graphql.org/October2021#sec-Unions
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
fn resolve_into_type_async<'a>( fn resolve_into_type_async<'a>(
&'a self, &'a self,
info: &'a Self::TypeInfo, info: &'a Self::TypeInfo,
@ -91,8 +91,8 @@ where
/// ///
/// The default implementation panics, if `selection_set` is [`None`]. /// The default implementation panics, if `selection_set` is [`None`].
/// ///
/// [0]: https://spec.graphql.org/June2018/#sec-Errors-and-Non-Nullability /// [0]: https://spec.graphql.org/October2021#sec-Handling-Field-Errors
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
fn resolve_async<'a>( fn resolve_async<'a>(
&'a self, &'a self,
info: &'a Self::TypeInfo, info: &'a Self::TypeInfo,

View file

@ -150,14 +150,14 @@ impl<'a, S> Arguments<'a, S> {
/// This trait is intended to be used in a conjunction with a [`GraphQLType`] trait. See the example /// This trait is intended to be used in a conjunction with a [`GraphQLType`] trait. See the example
/// in the documentation of a [`GraphQLType`] trait. /// in the documentation of a [`GraphQLType`] trait.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Unions /// [2]: https://spec.graphql.org/October2021#sec-Unions
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
/// [4]: https://spec.graphql.org/June2018/#sec-Scalars /// [4]: https://spec.graphql.org/October2021#sec-Scalars
/// [5]: https://spec.graphql.org/June2018/#sec-Enums /// [5]: https://spec.graphql.org/October2021#sec-Enums
/// [6]: https://spec.graphql.org/June2018/#sec-Type-System.List /// [6]: https://spec.graphql.org/October2021#sec-List
/// [7]: https://spec.graphql.org/June2018/#sec-Type-System.Non-Null /// [7]: https://spec.graphql.org/October2021#sec-Non-Null
/// [8]: https://spec.graphql.org/June2018/#sec-Input-Objects /// [8]: https://spec.graphql.org/October2021#sec-Input-Objects
/// [11]: https://doc.rust-lang.org/reference/items/traits.html#object-safety /// [11]: https://doc.rust-lang.org/reference/items/traits.html#object-safety
/// [12]: https://doc.rust-lang.org/reference/types/trait-object.html /// [12]: https://doc.rust-lang.org/reference/types/trait-object.html
pub trait GraphQLValue<S = DefaultScalarValue> pub trait GraphQLValue<S = DefaultScalarValue>
@ -196,7 +196,7 @@ where
/// ///
/// The default implementation panics. /// The default implementation panics.
/// ///
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
fn resolve_field( fn resolve_field(
&self, &self,
_info: &Self::TypeInfo, _info: &Self::TypeInfo,
@ -217,9 +217,9 @@ where
/// ///
/// The default implementation panics. /// The default implementation panics.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Unions /// [2]: https://spec.graphql.org/October2021#sec-Unions
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
fn resolve_into_type( fn resolve_into_type(
&self, &self,
info: &Self::TypeInfo, info: &Self::TypeInfo,
@ -243,9 +243,9 @@ where
/// ///
/// The default implementation panics. /// The default implementation panics.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Unions /// [2]: https://spec.graphql.org/October2021#sec-Unions
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
#[allow(unused_variables)] #[allow(unused_variables)]
fn concrete_type_name(&self, context: &Self::Context, info: &Self::TypeInfo) -> String { fn concrete_type_name(&self, context: &Self::Context, info: &Self::TypeInfo) -> String {
panic!( panic!(
@ -271,8 +271,8 @@ where
/// ///
/// The default implementation panics, if `selection_set` is [`None`]. /// The default implementation panics, if `selection_set` is [`None`].
/// ///
/// [0]: https://spec.graphql.org/June2018/#sec-Errors-and-Non-Nullability /// [0]: https://spec.graphql.org/October2021#sec-Errors-and-Non-Nullability
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
fn resolve( fn resolve(
&self, &self,
info: &Self::TypeInfo, info: &Self::TypeInfo,
@ -385,7 +385,7 @@ where
/// } /// }
/// ``` /// ```
/// ///
/// [3]: https://spec.graphql.org/June2018/#sec-Objects /// [3]: https://spec.graphql.org/October2021#sec-Objects
pub trait GraphQLType<S = DefaultScalarValue>: GraphQLValue<S> pub trait GraphQLType<S = DefaultScalarValue>: GraphQLValue<S>
where where
S: ScalarValue, S: ScalarValue,

View file

@ -17,19 +17,19 @@ use crate::{GraphQLType, ScalarValue};
/// [GraphQL objects][1]. Other types ([scalars][2], [enums][3], [interfaces][4], [input objects][5] /// [GraphQL objects][1]. Other types ([scalars][2], [enums][3], [interfaces][4], [input objects][5]
/// and [unions][6]) are not allowed. /// and [unions][6]) are not allowed.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
/// [2]: https://spec.graphql.org/June2018/#sec-Scalars /// [2]: https://spec.graphql.org/October2021#sec-Scalars
/// [3]: https://spec.graphql.org/June2018/#sec-Enums /// [3]: https://spec.graphql.org/October2021#sec-Enums
/// [4]: https://spec.graphql.org/June2018/#sec-Interfaces /// [4]: https://spec.graphql.org/October2021#sec-Interfaces
/// [5]: https://spec.graphql.org/June2018/#sec-Input-Objects /// [5]: https://spec.graphql.org/October2021#sec-Input-Objects
/// [6]: https://spec.graphql.org/June2018/#sec-Unions /// [6]: https://spec.graphql.org/October2021#sec-Unions
pub trait GraphQLObject<S: ScalarValue>: GraphQLType<S> { pub trait GraphQLObject<S: ScalarValue>: GraphQLType<S> {
/// An arbitrary function without meaning. /// An arbitrary function without meaning.
/// ///
/// May contain compile timed check logic which ensures that types are used correctly according /// May contain compile timed check logic which ensures that types are used correctly according
/// to the [GraphQL specification][1]. /// to the [GraphQL specification][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/ /// [1]: https://spec.graphql.org/October2021
fn mark() {} fn mark() {}
} }
@ -74,19 +74,19 @@ where
/// [GraphQL interfaces][1]. Other types ([scalars][2], [enums][3], [objects][4], [input objects][5] /// [GraphQL interfaces][1]. Other types ([scalars][2], [enums][3], [objects][4], [input objects][5]
/// and [unions][6]) are not allowed. /// and [unions][6]) are not allowed.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Scalars /// [2]: https://spec.graphql.org/October2021#sec-Scalars
/// [3]: https://spec.graphql.org/June2018/#sec-Enums /// [3]: https://spec.graphql.org/October2021#sec-Enums
/// [4]: https://spec.graphql.org/June2018/#sec-Objects /// [4]: https://spec.graphql.org/October2021#sec-Objects
/// [5]: https://spec.graphql.org/June2018/#sec-Input-Objects /// [5]: https://spec.graphql.org/October2021#sec-Input-Objects
/// [6]: https://spec.graphql.org/June2018/#sec-Unions /// [6]: https://spec.graphql.org/October2021#sec-Unions
pub trait GraphQLInterface<S: ScalarValue>: GraphQLType<S> { pub trait GraphQLInterface<S: ScalarValue>: GraphQLType<S> {
/// An arbitrary function without meaning. /// An arbitrary function without meaning.
/// ///
/// May contain compile timed check logic which ensures that types are used correctly according /// May contain compile timed check logic which ensures that types are used correctly according
/// to the [GraphQL specification][1]. /// to the [GraphQL specification][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/ /// [1]: https://spec.graphql.org/October2021
fn mark() {} fn mark() {}
} }
@ -131,19 +131,19 @@ where
/// [GraphQL unions][1]. Other types ([scalars][2], [enums][3], [objects][4], [input objects][5] and /// [GraphQL unions][1]. Other types ([scalars][2], [enums][3], [objects][4], [input objects][5] and
/// [interfaces][6]) are not allowed. /// [interfaces][6]) are not allowed.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
/// [2]: https://spec.graphql.org/June2018/#sec-Scalars /// [2]: https://spec.graphql.org/October2021#sec-Scalars
/// [3]: https://spec.graphql.org/June2018/#sec-Enums /// [3]: https://spec.graphql.org/October2021#sec-Enums
/// [4]: https://spec.graphql.org/June2018/#sec-Objects /// [4]: https://spec.graphql.org/October2021#sec-Objects
/// [5]: https://spec.graphql.org/June2018/#sec-Input-Objects /// [5]: https://spec.graphql.org/October2021#sec-Input-Objects
/// [6]: https://spec.graphql.org/June2018/#sec-Interfaces /// [6]: https://spec.graphql.org/October2021#sec-Interfaces
pub trait GraphQLUnion<S: ScalarValue>: GraphQLType<S> { pub trait GraphQLUnion<S: ScalarValue>: GraphQLType<S> {
/// An arbitrary function without meaning. /// An arbitrary function without meaning.
/// ///
/// May contain compile timed check logic which ensures that types are used correctly according /// May contain compile timed check logic which ensures that types are used correctly according
/// to the [GraphQL specification][1]. /// to the [GraphQL specification][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/ /// [1]: https://spec.graphql.org/October2021
fn mark() {} fn mark() {}
} }

View file

@ -94,8 +94,8 @@ pub trait SubscriptionConnection<S>: futures::Stream<Item = ExecutionOutput<S>>
/// ///
/// See trait methods for more detailed explanation on how this trait works. /// See trait methods for more detailed explanation on how this trait works.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Subscription /// [1]: https://spec.graphql.org/October2021#sec-Subscription
/// [2]: https://spec.graphql.org/June2018/#sec-Objects /// [2]: https://spec.graphql.org/October2021#sec-Objects
pub trait GraphQLSubscriptionValue<S = DefaultScalarValue>: GraphQLValue<S> + Sync pub trait GraphQLSubscriptionValue<S = DefaultScalarValue>: GraphQLValue<S> + Sync
where where
Self::TypeInfo: Sync, Self::TypeInfo: Sync,
@ -204,7 +204,7 @@ crate::sa::assert_obj_safe!(GraphQLSubscriptionValue<Context = (), TypeInfo = ()
/// It's automatically implemented for [`GraphQLSubscriptionValue`] and [`GraphQLType`] /// It's automatically implemented for [`GraphQLSubscriptionValue`] and [`GraphQLType`]
/// implementers, so doesn't require manual or code-generated implementation. /// implementers, so doesn't require manual or code-generated implementation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Subscription /// [1]: https://spec.graphql.org/October2021#sec-Subscription
pub trait GraphQLSubscriptionType<S = DefaultScalarValue>: pub trait GraphQLSubscriptionType<S = DefaultScalarValue>:
GraphQLSubscriptionValue<S> + GraphQLType<S> GraphQLSubscriptionValue<S> + GraphQLType<S>
where where

View file

@ -228,20 +228,20 @@ pub trait ScalarValue:
/// ///
/// These types closely follow the [GraphQL specification][0]. /// These types closely follow the [GraphQL specification][0].
/// ///
/// [0]: https://spec.graphql.org/June2018 /// [0]: https://spec.graphql.org/October2021
#[derive(Clone, Debug, PartialEq, ScalarValue, Serialize)] #[derive(Clone, Debug, PartialEq, ScalarValue, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum DefaultScalarValue { pub enum DefaultScalarValue {
/// [`Int` scalar][0] as a signed 32bit numeric nonfractional value. /// [`Int` scalar][0] as a signed 32bit numeric nonfractional value.
/// ///
/// [0]: https://spec.graphql.org/June2018/#sec-Int /// [0]: https://spec.graphql.org/October2021#sec-Int
#[value(as_float, as_int)] #[value(as_float, as_int)]
Int(i32), Int(i32),
/// [`Float` scalar][0] as a signed doubleprecision fractional values as /// [`Float` scalar][0] as a signed doubleprecision fractional values as
/// specified by [IEEE 754]. /// specified by [IEEE 754].
/// ///
/// [0]: https://spec.graphql.org/June2018/#sec-Float /// [0]: https://spec.graphql.org/October2021#sec-Float
/// [IEEE 754]: https://en.wikipedia.org/wiki/IEEE_floating_point /// [IEEE 754]: https://en.wikipedia.org/wiki/IEEE_floating_point
#[value(as_float)] #[value(as_float)]
Float(f64), Float(f64),
@ -249,13 +249,13 @@ pub enum DefaultScalarValue {
/// [`String` scalar][0] as a textual data, represented as UTF8 character /// [`String` scalar][0] as a textual data, represented as UTF8 character
/// sequences. /// sequences.
/// ///
/// [0]: https://spec.graphql.org/June2018/#sec-String /// [0]: https://spec.graphql.org/October2021#sec-String
#[value(as_str, as_string, into_string)] #[value(as_str, as_string, into_string)]
String(String), String(String),
/// [`Boolean` scalar][0] as a `true` or `false` value. /// [`Boolean` scalar][0] as a `true` or `false` value.
/// ///
/// [0]: https://spec.graphql.org/June2018/#sec-Boolean /// [0]: https://spec.graphql.org/October2021#sec-Boolean
#[value(as_bool)] #[value(as_bool)]
Boolean(bool), Boolean(bool),
} }

View file

@ -1,7 +1,7 @@
//! Common functions, definitions and extensions for parsing and code generation //! Common functions, definitions and extensions for parsing and code generation
//! of [GraphQL arguments][1] //! of [GraphQL arguments][1]
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments. //! [1]: https://spec.graphql.org/October2021#sec-Language.Arguments.
use std::mem; use std::mem;
@ -29,7 +29,7 @@ use crate::{
/// Available metadata (arguments) behind `#[graphql]` attribute placed on a /// Available metadata (arguments) behind `#[graphql]` attribute placed on a
/// method argument, when generating code for [GraphQL argument][1]. /// method argument, when generating code for [GraphQL argument][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub(crate) struct Attr { pub(crate) struct Attr {
/// Explicitly specified name of a [GraphQL argument][1] represented by this /// Explicitly specified name of a [GraphQL argument][1] represented by this
@ -37,13 +37,13 @@ pub(crate) struct Attr {
/// ///
/// If [`None`], then `camelCased` Rust argument name is used by default. /// If [`None`], then `camelCased` Rust argument name is used by default.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
pub(crate) name: Option<SpanContainer<syn::LitStr>>, pub(crate) name: Option<SpanContainer<syn::LitStr>>,
/// Explicitly specified [description][2] of this [GraphQL argument][1]. /// Explicitly specified [description][2] of this [GraphQL argument][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
pub(crate) description: Option<SpanContainer<syn::LitStr>>, pub(crate) description: Option<SpanContainer<syn::LitStr>>,
/// Explicitly specified [default value][2] of this [GraphQL argument][1]. /// Explicitly specified [default value][2] of this [GraphQL argument][1].
@ -54,8 +54,8 @@ pub(crate) struct Attr {
/// If [`None`], then this [GraphQL argument][1] is considered as /// If [`None`], then this [GraphQL argument][1] is considered as
/// [required][2]. /// [required][2].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
/// [2]: https://spec.graphql.org/June2018/#sec-Required-Arguments /// [2]: https://spec.graphql.org/October2021#sec-Required-Arguments
pub(crate) default: Option<SpanContainer<Option<syn::Expr>>>, pub(crate) default: Option<SpanContainer<Option<syn::Expr>>>,
/// Explicitly specified marker indicating that this method argument doesn't /// Explicitly specified marker indicating that this method argument doesn't
@ -66,8 +66,8 @@ pub(crate) struct Attr {
/// if it's named `context` or `ctx`. /// if it's named `context` or `ctx`.
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
/// [2]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [2]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) context: Option<SpanContainer<syn::Ident>>, pub(crate) context: Option<SpanContainer<syn::Ident>>,
/// Explicitly specified marker indicating that this method argument doesn't /// Explicitly specified marker indicating that this method argument doesn't
@ -78,8 +78,8 @@ pub(crate) struct Attr {
/// if it's named `executor`. /// if it's named `executor`.
/// ///
/// [`Executor`]: juniper::Executor /// [`Executor`]: juniper::Executor
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
/// [2]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [2]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) executor: Option<SpanContainer<syn::Ident>>, pub(crate) executor: Option<SpanContainer<syn::Ident>>,
} }
@ -223,24 +223,24 @@ impl Attr {
/// Representation of a [GraphQL field argument][1] for code generation. /// Representation of a [GraphQL field argument][1] for code generation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct OnField { pub(crate) struct OnField {
/// Rust type that this [GraphQL field argument][1] is represented by. /// Rust type that this [GraphQL field argument][1] is represented by.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
pub(crate) ty: syn::Type, pub(crate) ty: syn::Type,
/// Name of this [GraphQL field argument][2] in GraphQL schema. /// Name of this [GraphQL field argument][2] in GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
pub(crate) name: String, pub(crate) name: String,
/// [Description][2] of this [GraphQL field argument][1] to put into GraphQL /// [Description][2] of this [GraphQL field argument][1] to put into GraphQL
/// schema. /// schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
pub(crate) description: Option<String>, pub(crate) description: Option<String>,
/// Default value of this [GraphQL field argument][1] in GraphQL schema. /// Default value of this [GraphQL field argument][1] in GraphQL schema.
@ -250,8 +250,8 @@ pub(crate) struct OnField {
/// ///
/// If inner [`Option`] is [`None`], then the [`Default`] value is used. /// If inner [`Option`] is [`None`], then the [`Default`] value is used.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
/// [2]: https://spec.graphql.org/June2018/#sec-Required-Arguments /// [2]: https://spec.graphql.org/October2021#sec-Required-Arguments
pub(crate) default: Option<Option<syn::Expr>>, pub(crate) default: Option<Option<syn::Expr>>,
} }
@ -260,19 +260,19 @@ pub(crate) struct OnField {
pub(crate) enum OnMethod { pub(crate) enum OnMethod {
/// Regular [GraphQL field argument][1]. /// Regular [GraphQL field argument][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Arguments /// [1]: https://spec.graphql.org/October2021#sec-Language.Arguments
Regular(Box<OnField>), Regular(Box<OnField>),
/// [`Context`] passed into a [GraphQL field][2] resolving method. /// [`Context`] passed into a [GraphQL field][2] resolving method.
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [2]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [2]: https://spec.graphql.org/October2021#sec-Language.Fields
Context(Box<syn::Type>), Context(Box<syn::Type>),
/// [`Executor`] passed into a [GraphQL field][2] resolving method. /// [`Executor`] passed into a [GraphQL field][2] resolving method.
/// ///
/// [`Executor`]: juniper::Executor /// [`Executor`]: juniper::Executor
/// [2]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [2]: https://spec.graphql.org/October2021#sec-Language.Fields
Executor, Executor,
} }

View file

@ -1,7 +1,7 @@
//! Common functions, definitions and extensions for parsing and code generation //! Common functions, definitions and extensions for parsing and code generation
//! of [GraphQL fields][1] //! of [GraphQL fields][1]
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Language.Fields //! [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) mod arg; pub(crate) mod arg;
@ -30,14 +30,14 @@ pub(crate) use self::arg::OnMethod as MethodArgument;
/// Available metadata (arguments) behind `#[graphql]` attribute placed on a /// Available metadata (arguments) behind `#[graphql]` attribute placed on a
/// [GraphQL field][1] definition. /// [GraphQL field][1] definition.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub(crate) struct Attr { pub(crate) struct Attr {
/// Explicitly specified name of this [GraphQL field][1]. /// Explicitly specified name of this [GraphQL field][1].
/// ///
/// If [`None`], then `camelCased` Rust method name is used by default. /// If [`None`], then `camelCased` Rust method name is used by default.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) name: Option<SpanContainer<syn::LitStr>>, pub(crate) name: Option<SpanContainer<syn::LitStr>>,
/// Explicitly specified [description][2] of this [GraphQL field][1]. /// Explicitly specified [description][2] of this [GraphQL field][1].
@ -45,8 +45,8 @@ pub(crate) struct Attr {
/// If [`None`], then Rust doc comment will be used as the [description][2], /// If [`None`], then Rust doc comment will be used as the [description][2],
/// if any. /// if any.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
pub(crate) description: Option<SpanContainer<syn::LitStr>>, pub(crate) description: Option<SpanContainer<syn::LitStr>>,
/// Explicitly specified [deprecation][2] of this [GraphQL field][1]. /// Explicitly specified [deprecation][2] of this [GraphQL field][1].
@ -54,15 +54,15 @@ pub(crate) struct Attr {
/// If [`None`], then Rust `#[deprecated]` attribute will be used as the /// If [`None`], then Rust `#[deprecated]` attribute will be used as the
/// [deprecation][2], if any. /// [deprecation][2], if any.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
/// [2]: https://spec.graphql.org/June2018/#sec-Deprecation /// [2]: https://spec.graphql.org/October2021#sec-Deprecation
pub(crate) deprecated: Option<SpanContainer<Option<syn::LitStr>>>, pub(crate) deprecated: Option<SpanContainer<Option<syn::LitStr>>>,
/// Explicitly specified marker indicating that this method (or struct /// Explicitly specified marker indicating that this method (or struct
/// field) should be omitted by code generation and not considered as the /// field) should be omitted by code generation and not considered as the
/// [GraphQL field][1] definition. /// [GraphQL field][1] definition.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) ignore: Option<SpanContainer<syn::Ident>>, pub(crate) ignore: Option<SpanContainer<syn::Ident>>,
} }
@ -129,7 +129,7 @@ impl Attr {
/// Parses [`Attr`] from the given multiple `name`d [`syn::Attribute`]s /// Parses [`Attr`] from the given multiple `name`d [`syn::Attribute`]s
/// placed on a [GraphQL field][1] definition. /// placed on a [GraphQL field][1] definition.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) fn from_attrs(name: &str, attrs: &[syn::Attribute]) -> syn::Result<Self> { pub(crate) fn from_attrs(name: &str, attrs: &[syn::Attribute]) -> syn::Result<Self> {
let mut attr = filter_attrs(name, attrs) let mut attr = filter_attrs(name, attrs)
.map(|attr| attr.parse_args()) .map(|attr| attr.parse_args())
@ -164,24 +164,24 @@ impl Attr {
/// Representation of a [GraphQL field][1] for code generation. /// Representation of a [GraphQL field][1] for code generation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct Definition { pub(crate) struct Definition {
/// Rust type that this [GraphQL field][1] is represented by (method return /// Rust type that this [GraphQL field][1] is represented by (method return
/// type or struct field type). /// type or struct field type).
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) ty: syn::Type, pub(crate) ty: syn::Type,
/// Name of this [GraphQL field][1] in GraphQL schema. /// Name of this [GraphQL field][1] in GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) name: String, pub(crate) name: String,
/// [Description][2] of this [GraphQL field][1] to put into GraphQL schema. /// [Description][2] of this [GraphQL field][1] to put into GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
pub(crate) description: Option<String>, pub(crate) description: Option<String>,
/// [Deprecation][2] of this [GraphQL field][1] to put into GraphQL schema. /// [Deprecation][2] of this [GraphQL field][1] to put into GraphQL schema.
@ -189,14 +189,14 @@ pub(crate) struct Definition {
/// If inner [`Option`] is [`None`], then deprecation has no message /// If inner [`Option`] is [`None`], then deprecation has no message
/// attached. /// attached.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
/// [2]: https://spec.graphql.org/June2018/#sec-Deprecation /// [2]: https://spec.graphql.org/October2021#sec-Deprecation
pub(crate) deprecated: Option<Option<String>>, pub(crate) deprecated: Option<Option<String>>,
/// Ident of the Rust method (or struct field) representing this /// Ident of the Rust method (or struct field) representing this
/// [GraphQL field][1]. /// [GraphQL field][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) ident: syn::Ident, pub(crate) ident: syn::Ident,
/// Rust [`MethodArgument`]s required to call the method representing this /// Rust [`MethodArgument`]s required to call the method representing this
@ -205,19 +205,19 @@ pub(crate) struct Definition {
/// If [`None`] then this [GraphQL field][1] is represented by a struct /// If [`None`] then this [GraphQL field][1] is represented by a struct
/// field. /// field.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) arguments: Option<Vec<MethodArgument>>, pub(crate) arguments: Option<Vec<MethodArgument>>,
/// Indicator whether the Rust method representing this [GraphQL field][1] /// Indicator whether the Rust method representing this [GraphQL field][1]
/// has a [`syn::Receiver`]. /// has a [`syn::Receiver`].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) has_receiver: bool, pub(crate) has_receiver: bool,
/// Indicator whether this [GraphQL field][1] should be resolved /// Indicator whether this [GraphQL field][1] should be resolved
/// asynchronously. /// asynchronously.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) is_async: bool, pub(crate) is_async: bool,
} }
@ -225,7 +225,7 @@ impl Definition {
/// Indicates whether this [GraphQL field][1] is represented by a method, /// Indicates whether this [GraphQL field][1] is represented by a method,
/// not a struct field. /// not a struct field.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[must_use] #[must_use]
pub(crate) fn is_method(&self) -> bool { pub(crate) fn is_method(&self) -> bool {
self.arguments.is_some() self.arguments.is_some()
@ -235,7 +235,7 @@ impl Definition {
/// tried to be resolved in the [`GraphQLValue::resolve_field`] method. /// tried to be resolved in the [`GraphQLValue::resolve_field`] method.
/// ///
/// [`GraphQLValue::resolve_field`]: juniper::GraphQLValue::resolve_field /// [`GraphQLValue::resolve_field`]: juniper::GraphQLValue::resolve_field
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[must_use] #[must_use]
pub(crate) fn method_resolve_field_err_no_field_tokens( pub(crate) fn method_resolve_field_err_no_field_tokens(
scalar: &scalar::Type, scalar: &scalar::Type,
@ -255,7 +255,7 @@ impl Definition {
/// which performs static checks for this [GraphQL field][1]. /// which performs static checks for this [GraphQL field][1].
/// ///
/// [`marker::IsOutputType::mark`]: juniper::marker::IsOutputType::mark /// [`marker::IsOutputType::mark`]: juniper::marker::IsOutputType::mark
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[must_use] #[must_use]
pub(crate) fn method_mark_tokens( pub(crate) fn method_mark_tokens(
&self, &self,
@ -291,7 +291,7 @@ impl Definition {
/// ///
/// [`GraphQLType::meta`]: juniper::GraphQLType::meta /// [`GraphQLType::meta`]: juniper::GraphQLType::meta
/// [`Registry`]: juniper::Registry /// [`Registry`]: juniper::Registry
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[must_use] #[must_use]
pub(crate) fn method_meta_tokens( pub(crate) fn method_meta_tokens(
&self, &self,
@ -336,8 +336,8 @@ impl Definition {
/// resolves this [GraphQL field][1] as [subscription][2]. /// resolves this [GraphQL field][1] as [subscription][2].
/// ///
/// [0]: juniper::GraphQLSubscriptionValue::resolve_field_into_stream /// [0]: juniper::GraphQLSubscriptionValue::resolve_field_into_stream
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
/// [2]: https://spec.graphql.org/June2018/#sec-Subscription /// [2]: https://spec.graphql.org/October2021#sec-Subscription
#[must_use] #[must_use]
pub(crate) fn method_resolve_field_into_stream_tokens( pub(crate) fn method_resolve_field_into_stream_tokens(
&self, &self,
@ -401,7 +401,7 @@ impl Definition {
/// Checks whether all [GraphQL fields][1] fields have different names. /// Checks whether all [GraphQL fields][1] fields have different names.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [1]: https://spec.graphql.org/October2021#sec-Language.Fields
#[must_use] #[must_use]
pub(crate) fn all_different(fields: &[Definition]) -> bool { pub(crate) fn all_different(fields: &[Definition]) -> bool {
let mut names: Vec<_> = fields.iter().map(|f| &f.name).collect(); let mut names: Vec<_> = fields.iter().map(|f| &f.name).collect();

View file

@ -8,7 +8,7 @@ use quote::quote;
/// Value of a [GraphQL type][1] should be stored in a `res` binding in the generated code, before /// Value of a [GraphQL type][1] should be stored in a `res` binding in the generated code, before
/// including this piece of code. /// including this piece of code.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Types /// [1]: https://spec.graphql.org/October2021#sec-Types
pub(crate) fn sync_resolving_code() -> TokenStream { pub(crate) fn sync_resolving_code() -> TokenStream {
quote! { quote! {
::juniper::IntoResolvable::into(res, executor.context()) ::juniper::IntoResolvable::into(res, executor.context())
@ -29,7 +29,7 @@ pub(crate) fn sync_resolving_code() -> TokenStream {
/// ///
/// [`Future`]: std::future::Future /// [`Future`]: std::future::Future
/// [`Future::Output`]: std::future::Future::Output /// [`Future::Output`]: std::future::Future::Output
/// [1]: https://spec.graphql.org/June2018/#sec-Types /// [1]: https://spec.graphql.org/October2021#sec-Types
pub(crate) fn async_resolving_code(ty: Option<&syn::Type>) -> TokenStream { pub(crate) fn async_resolving_code(ty: Option<&syn::Type>) -> TokenStream {
let ty = ty.map(|t| quote! { : #t }); let ty = ty.map(|t| quote! { : #t });

View file

@ -1,8 +1,8 @@
//! Common functions, definitions and extensions for parsing downcasting functions, used by GraphQL //! Common functions, definitions and extensions for parsing downcasting functions, used by GraphQL
//! [interfaces][1] and [unions][2] definitions to downcast its type to a concrete implementer type. //! [interfaces][1] and [unions][2] definitions to downcast its type to a concrete implementer type.
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Interfaces //! [1]: https://spec.graphql.org/October2021#sec-Interfaces
//! [2]: https://spec.graphql.org/June2018/#sec-Unions //! [2]: https://spec.graphql.org/October2021#sec-Unions
use proc_macro2::Span; use proc_macro2::Span;
use syn::{ext::IdentExt as _, spanned::Spanned as _}; use syn::{ext::IdentExt as _, spanned::Spanned as _};

View file

@ -1,6 +1,6 @@
//! Code generation for [GraphQL interface][1]. //! Code generation for [GraphQL interface][1].
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Interfaces //! [1]: https://spec.graphql.org/October2021#sec-Interfaces
pub mod attr; pub mod attr;
pub mod derive; pub mod derive;
@ -35,7 +35,7 @@ use crate::{
/// on it and enum alias which generic arguments are filled with /// on it and enum alias which generic arguments are filled with
/// [GraphQL interface][1] implementers. /// [GraphQL interface][1] implementers.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
fn enum_idents( fn enum_idents(
trait_ident: &syn::Ident, trait_ident: &syn::Ident,
alias_ident: Option<&syn::Ident>, alias_ident: Option<&syn::Ident>,
@ -54,14 +54,14 @@ fn enum_idents(
/// trait or struct definition, when generating code for [GraphQL interface][1] /// trait or struct definition, when generating code for [GraphQL interface][1]
/// type. /// type.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[derive(Debug, Default)] #[derive(Debug, Default)]
struct Attr { struct Attr {
/// Explicitly specified name of [GraphQL interface][1] type. /// Explicitly specified name of [GraphQL interface][1] type.
/// ///
/// If [`None`], then Rust trait name is used by default. /// If [`None`], then Rust trait name is used by default.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
name: Option<SpanContainer<String>>, name: Option<SpanContainer<String>>,
/// Explicitly specified [description][2] of [GraphQL interface][1] type. /// Explicitly specified [description][2] of [GraphQL interface][1] type.
@ -69,8 +69,8 @@ struct Attr {
/// If [`None`], then Rust doc comment will be used as the [description][2], /// If [`None`], then Rust doc comment will be used as the [description][2],
/// if any. /// if any.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
description: Option<SpanContainer<String>>, description: Option<SpanContainer<String>>,
/// Explicitly specified identifier of the type alias of Rust enum type /// Explicitly specified identifier of the type alias of Rust enum type
@ -79,14 +79,14 @@ struct Attr {
/// ///
/// If [`None`], then `{trait_name}Value` identifier will be used. /// If [`None`], then `{trait_name}Value` identifier will be used.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
r#enum: Option<SpanContainer<syn::Ident>>, r#enum: Option<SpanContainer<syn::Ident>>,
/// Explicitly specified Rust types of [GraphQL objects][2] or /// Explicitly specified Rust types of [GraphQL objects][2] or
/// [interfaces][1] implementing this [GraphQL interface][1] type. /// [interfaces][1] implementing this [GraphQL interface][1] type.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Objects /// [2]: https://spec.graphql.org/October2021#sec-Objects
implemented_for: HashSet<SpanContainer<syn::TypePath>>, implemented_for: HashSet<SpanContainer<syn::TypePath>>,
/// Explicitly specified [GraphQL interfaces, implemented][1] by this /// Explicitly specified [GraphQL interfaces, implemented][1] by this
@ -102,7 +102,7 @@ struct Attr {
/// If [`None`], then unit type `()` is assumed as a type of [`Context`]. /// If [`None`], then unit type `()` is assumed as a type of [`Context`].
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
context: Option<SpanContainer<syn::Type>>, context: Option<SpanContainer<syn::Type>>,
/// Explicitly specified type (or type parameter with its bounds) of /// Explicitly specified type (or type parameter with its bounds) of
@ -116,7 +116,7 @@ struct Attr {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
scalar: Option<SpanContainer<scalar::AttrValue>>, scalar: Option<SpanContainer<scalar::AttrValue>>,
/// Explicitly specified marker indicating that the Rust trait should be /// Explicitly specified marker indicating that the Rust trait should be
@ -131,7 +131,7 @@ struct Attr {
/// ///
/// If [`None`] then the default rule will be [`RenameRule::CamelCase`]. /// If [`None`] then the default rule will be [`RenameRule::CamelCase`].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
rename_fields: Option<SpanContainer<RenameRule>>, rename_fields: Option<SpanContainer<RenameRule>>,
/// Indicator whether the generated code is intended to be used only inside /// Indicator whether the generated code is intended to be used only inside
@ -277,18 +277,18 @@ impl Attr {
/// Definition of [GraphQL interface][1] for code generation. /// Definition of [GraphQL interface][1] for code generation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
struct Definition { struct Definition {
/// [`syn::Generics`] of the trait or struct describing the /// [`syn::Generics`] of the trait or struct describing the
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
generics: syn::Generics, generics: syn::Generics,
/// [`syn::Visibility`] of the trait or struct describing the /// [`syn::Visibility`] of the trait or struct describing the
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
vis: syn::Visibility, vis: syn::Visibility,
/// Name of the generic enum describing all [`implementers`]. It's generic /// Name of the generic enum describing all [`implementers`]. It's generic
@ -319,7 +319,7 @@ struct Definition {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
context: syn::Type, context: syn::Type,
/// [`ScalarValue`] parametrization to generate [`GraphQLType`] /// [`ScalarValue`] parametrization to generate [`GraphQLType`]
@ -327,18 +327,18 @@ struct Definition {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
scalar: scalar::Type, scalar: scalar::Type,
/// Defined [GraphQL fields][2] of this [GraphQL interface][1]. /// Defined [GraphQL fields][2] of this [GraphQL interface][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [2]: https://spec.graphql.org/October2021#sec-Language.Fields
fields: Vec<field::Definition>, fields: Vec<field::Definition>,
/// Defined [`Implementer`]s of this [GraphQL interface][1]. /// Defined [`Implementer`]s of this [GraphQL interface][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
implemented_for: Vec<syn::TypePath>, implemented_for: Vec<syn::TypePath>,
/// [GraphQL interfaces implemented][1] by this [GraphQL interface][0]. /// [GraphQL interfaces implemented][1] by this [GraphQL interface][0].
@ -352,7 +352,7 @@ struct Definition {
/// [GraphQL interface][1]. We generate hacky `const` which doesn't actually /// [GraphQL interface][1]. We generate hacky `const` which doesn't actually
/// use it, but suppresses this warning. /// use it, but suppresses this warning.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
suppress_dead_code: Option<(syn::Ident, syn::Fields)>, suppress_dead_code: Option<(syn::Ident, syn::Fields)>,
/// Intra-doc link to the [`syn::Item`] defining this /// Intra-doc link to the [`syn::Item`] defining this
@ -440,13 +440,13 @@ impl Definition {
"Enum building an opaque value represented by [`{}`]({}) \ "Enum building an opaque value represented by [`{}`]({}) \
[GraphQL interface][0].\ [GraphQL interface][0].\
\n\n\ \n\n\
[0]: https://spec.graphql.org/June2018/#sec-Interfaces", [0]: https://spec.graphql.org/October2021#sec-Interfaces",
self.name, self.src_intra_doc_link, self.name, self.src_intra_doc_link,
); );
let enum_alias_doc = format!( let enum_alias_doc = format!(
"Opaque value represented by [`{}`]({}) [GraphQL interface][0].\ "Opaque value represented by [`{}`]({}) [GraphQL interface][0].\
\n\n\ \n\n\
[0]: https://spec.graphql.org/June2018/#sec-Interfaces", [0]: https://spec.graphql.org/October2021#sec-Interfaces",
self.name, self.src_intra_doc_link, self.name, self.src_intra_doc_link,
); );
@ -513,7 +513,7 @@ impl Definition {
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [`GraphQLInterface`]: juniper::GraphQLInterface /// [`GraphQLInterface`]: juniper::GraphQLInterface
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[must_use] #[must_use]
fn impl_graphql_interface_tokens(&self) -> TokenStream { fn impl_graphql_interface_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
@ -603,7 +603,7 @@ impl Definition {
/// this [GraphQL interface][1]. /// this [GraphQL interface][1].
/// ///
/// [`marker::IsOutputType`]: juniper::marker::IsOutputType /// [`marker::IsOutputType`]: juniper::marker::IsOutputType
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[must_use] #[must_use]
fn impl_output_type_tokens(&self) -> TokenStream { fn impl_output_type_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
@ -679,7 +679,7 @@ impl Definition {
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[must_use] #[must_use]
fn impl_graphql_type_tokens(&self) -> TokenStream { fn impl_graphql_type_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
@ -753,7 +753,7 @@ impl Definition {
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [`GraphQLValue`]: juniper::GraphQLValue /// [`GraphQLValue`]: juniper::GraphQLValue
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[must_use] #[must_use]
fn impl_graphql_value_tokens(&self) -> TokenStream { fn impl_graphql_value_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
@ -835,7 +835,7 @@ impl Definition {
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync /// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[must_use] #[must_use]
fn impl_graphql_value_async_tokens(&self) -> TokenStream { fn impl_graphql_value_async_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
@ -901,7 +901,7 @@ impl Definition {
/// [`BaseType`]: juniper::macros::reflect::BaseType /// [`BaseType`]: juniper::macros::reflect::BaseType
/// [`Fields`]: juniper::macros::reflect::Fields /// [`Fields`]: juniper::macros::reflect::Fields
/// [`WrappedType`]: juniper::macros::reflect::WrappedType /// [`WrappedType`]: juniper::macros::reflect::WrappedType
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[must_use] #[must_use]
fn impl_reflection_traits_tokens(&self) -> TokenStream { fn impl_reflection_traits_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
@ -966,7 +966,7 @@ impl Definition {
/// [GraphQL interface][1]. /// [GraphQL interface][1].
/// ///
/// [`FieldMeta`]: juniper::macros::reflect::FieldMeta /// [`FieldMeta`]: juniper::macros::reflect::FieldMeta
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
fn impl_field_meta_tokens(&self) -> TokenStream { fn impl_field_meta_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
let context = &self.context; let context = &self.context;
@ -1027,7 +1027,7 @@ impl Definition {
/// this [GraphQL interface][1]. /// this [GraphQL interface][1].
/// ///
/// [`Field`]: juniper::macros::reflect::Field /// [`Field`]: juniper::macros::reflect::Field
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
fn impl_field_tokens(&self) -> TokenStream { fn impl_field_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
let scalar = &self.scalar; let scalar = &self.scalar;
@ -1107,7 +1107,7 @@ impl Definition {
/// of this [GraphQL interface][1]. /// of this [GraphQL interface][1].
/// ///
/// [`AsyncField`]: juniper::macros::reflect::AsyncField /// [`AsyncField`]: juniper::macros::reflect::AsyncField
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
fn impl_async_field_tokens(&self) -> TokenStream { fn impl_async_field_tokens(&self) -> TokenStream {
let ty = &self.enum_alias_ident; let ty = &self.enum_alias_ident;
let scalar = &self.scalar; let scalar = &self.scalar;

View file

@ -1,6 +1,6 @@
//! Code generation for [GraphQL object][1]. //! Code generation for [GraphQL object][1].
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Objects //! [1]: https://spec.graphql.org/October2021#sec-Objects
pub mod attr; pub mod attr;
pub mod derive; pub mod derive;
@ -32,14 +32,14 @@ use syn::ext::IdentExt;
/// Available arguments behind `#[graphql]` (or `#[graphql_object]`) attribute /// Available arguments behind `#[graphql]` (or `#[graphql_object]`) attribute
/// when generating code for [GraphQL object][1] type. /// when generating code for [GraphQL object][1] type.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub(crate) struct Attr { pub(crate) struct Attr {
/// Explicitly specified name of this [GraphQL object][1] type. /// Explicitly specified name of this [GraphQL object][1] type.
/// ///
/// If [`None`], then Rust type name is used by default. /// If [`None`], then Rust type name is used by default.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) name: Option<SpanContainer<String>>, pub(crate) name: Option<SpanContainer<String>>,
/// Explicitly specified [description][2] of this [GraphQL object][1] type. /// Explicitly specified [description][2] of this [GraphQL object][1] type.
@ -47,8 +47,8 @@ pub(crate) struct Attr {
/// If [`None`], then Rust doc comment will be used as the [description][2], /// If [`None`], then Rust doc comment will be used as the [description][2],
/// if any. /// if any.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
pub(crate) description: Option<SpanContainer<String>>, pub(crate) description: Option<SpanContainer<String>>,
/// Explicitly specified type of [`Context`] to use for resolving this /// Explicitly specified type of [`Context`] to use for resolving this
@ -57,7 +57,7 @@ pub(crate) struct Attr {
/// If [`None`], then unit type `()` is assumed as a type of [`Context`]. /// If [`None`], then unit type `()` is assumed as a type of [`Context`].
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) context: Option<SpanContainer<syn::Type>>, pub(crate) context: Option<SpanContainer<syn::Type>>,
/// Explicitly specified type (or type parameter with its bounds) of /// Explicitly specified type (or type parameter with its bounds) of
@ -71,14 +71,14 @@ pub(crate) struct Attr {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) scalar: Option<SpanContainer<scalar::AttrValue>>, pub(crate) scalar: Option<SpanContainer<scalar::AttrValue>>,
/// Explicitly specified [GraphQL interfaces][2] this [GraphQL object][1] /// Explicitly specified [GraphQL interfaces][2] this [GraphQL object][1]
/// type implements. /// type implements.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
/// [2]: https://spec.graphql.org/June2018/#sec-Interfaces /// [2]: https://spec.graphql.org/October2021#sec-Interfaces
pub(crate) interfaces: HashSet<SpanContainer<syn::Type>>, pub(crate) interfaces: HashSet<SpanContainer<syn::Type>>,
/// Explicitly specified [`RenameRule`] for all fields of this /// Explicitly specified [`RenameRule`] for all fields of this
@ -86,7 +86,7 @@ pub(crate) struct Attr {
/// ///
/// If [`None`] then the default rule will be [`RenameRule::CamelCase`]. /// If [`None`] then the default rule will be [`RenameRule::CamelCase`].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) rename_fields: Option<SpanContainer<RenameRule>>, pub(crate) rename_fields: Option<SpanContainer<RenameRule>>,
/// Indicator whether the generated code is intended to be used only inside /// Indicator whether the generated code is intended to be used only inside
@ -204,30 +204,30 @@ impl Attr {
/// Definition of [GraphQL object][1] for code generation. /// Definition of [GraphQL object][1] for code generation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct Definition<Operation: ?Sized> { pub(crate) struct Definition<Operation: ?Sized> {
/// Name of this [GraphQL object][1] in GraphQL schema. /// Name of this [GraphQL object][1] in GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) name: String, pub(crate) name: String,
/// Rust type that this [GraphQL object][1] is represented with. /// Rust type that this [GraphQL object][1] is represented with.
/// ///
/// It should contain all its generics, if any. /// It should contain all its generics, if any.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) ty: syn::Type, pub(crate) ty: syn::Type,
/// Generics of the Rust type that this [GraphQL object][1] is implemented /// Generics of the Rust type that this [GraphQL object][1] is implemented
/// for. /// for.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) generics: syn::Generics, pub(crate) generics: syn::Generics,
/// Description of this [GraphQL object][1] to put into GraphQL schema. /// Description of this [GraphQL object][1] to put into GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) description: Option<String>, pub(crate) description: Option<String>,
/// Rust type of [`Context`] to generate [`GraphQLType`] implementation with /// Rust type of [`Context`] to generate [`GraphQLType`] implementation with
@ -235,7 +235,7 @@ pub(crate) struct Definition<Operation: ?Sized> {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) context: syn::Type, pub(crate) context: syn::Type,
/// [`ScalarValue`] parametrization to generate [`GraphQLType`] /// [`ScalarValue`] parametrization to generate [`GraphQLType`]
@ -243,28 +243,28 @@ pub(crate) struct Definition<Operation: ?Sized> {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
pub(crate) scalar: scalar::Type, pub(crate) scalar: scalar::Type,
/// Defined [GraphQL fields][2] of this [GraphQL object][1]. /// Defined [GraphQL fields][2] of this [GraphQL object][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
/// [2]: https://spec.graphql.org/June2018/#sec-Language.Fields /// [2]: https://spec.graphql.org/October2021#sec-Language.Fields
pub(crate) fields: Vec<field::Definition>, pub(crate) fields: Vec<field::Definition>,
/// [GraphQL interfaces][2] implemented by this [GraphQL object][1]. /// [GraphQL interfaces][2] implemented by this [GraphQL object][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
/// [2]: https://spec.graphql.org/June2018/#sec-Interfaces /// [2]: https://spec.graphql.org/October2021#sec-Interfaces
pub(crate) interfaces: HashSet<syn::Type>, pub(crate) interfaces: HashSet<syn::Type>,
/// [GraphQL operation][1] this [`Definition`] should generate code for. /// [GraphQL operation][1] this [`Definition`] should generate code for.
/// ///
/// Either [GraphQL query][2] or [GraphQL subscription][3]. /// Either [GraphQL query][2] or [GraphQL subscription][3].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Language.Operations /// [1]: https://spec.graphql.org/October2021#sec-Language.Operations
/// [2]: https://spec.graphql.org/June2018/#sec-Query /// [2]: https://spec.graphql.org/October2021#sec-Query
/// [3]: https://spec.graphql.org/June2018/#sec-Subscription /// [3]: https://spec.graphql.org/October2021#sec-Subscription
pub(crate) _operation: PhantomData<Box<Operation>>, pub(crate) _operation: PhantomData<Box<Operation>>,
} }
@ -277,7 +277,7 @@ impl<Operation: ?Sized + 'static> Definition<Operation> {
/// ///
/// [`GraphQLAsyncValue`]: juniper::GraphQLAsyncValue /// [`GraphQLAsyncValue`]: juniper::GraphQLAsyncValue
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
pub(crate) fn impl_generics(&self, for_async: bool) -> (TokenStream, Option<syn::WhereClause>) { pub(crate) fn impl_generics(&self, for_async: bool) -> (TokenStream, Option<syn::WhereClause>) {
let mut generics = self.generics.clone(); let mut generics = self.generics.clone();
@ -334,7 +334,7 @@ impl<Operation: ?Sized + 'static> Definition<Operation> {
/// this [GraphQL object][1]. /// this [GraphQL object][1].
/// ///
/// [`marker::IsOutputType`]: juniper::marker::IsOutputType /// [`marker::IsOutputType`]: juniper::marker::IsOutputType
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
pub(crate) fn impl_output_type_tokens(&self) -> TokenStream { pub(crate) fn impl_output_type_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -369,7 +369,7 @@ impl<Operation: ?Sized + 'static> Definition<Operation> {
/// [`BaseType`]: juniper::macros::reflect::BaseType /// [`BaseType`]: juniper::macros::reflect::BaseType
/// [`Fields`]: juniper::macros::reflect::Fields /// [`Fields`]: juniper::macros::reflect::Fields
/// [`WrappedType`]: juniper::macros::reflect::WrappedType /// [`WrappedType`]: juniper::macros::reflect::WrappedType
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
pub(crate) fn impl_reflection_traits_tokens(&self) -> TokenStream { pub(crate) fn impl_reflection_traits_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -428,7 +428,7 @@ impl<Operation: ?Sized + 'static> Definition<Operation> {
/// [GraphQL object][1]. /// [GraphQL object][1].
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
pub(crate) fn impl_graphql_type_tokens(&self) -> TokenStream { pub(crate) fn impl_graphql_type_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -491,7 +491,7 @@ impl<Operation: ?Sized + 'static> Definition<Operation> {
/// [GraphQL query operation][2] of the [`Definition`] to generate code for. /// [GraphQL query operation][2] of the [`Definition`] to generate code for.
/// ///
/// [2]: https://spec.graphql.org/June2018/#sec-Query /// [2]: https://spec.graphql.org/October2021#sec-Query
struct Query; struct Query;
impl ToTokens for Definition<Query> { impl ToTokens for Definition<Query> {
@ -513,7 +513,7 @@ impl Definition<Query> {
/// [GraphQL object][1]. /// [GraphQL object][1].
/// ///
/// [`GraphQLObject`]: juniper::GraphQLObject /// [`GraphQLObject`]: juniper::GraphQLObject
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
fn impl_graphql_object_tokens(&self) -> TokenStream { fn impl_graphql_object_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -561,7 +561,7 @@ impl Definition<Query> {
/// of this [GraphQL object][1]. /// of this [GraphQL object][1].
/// ///
/// [`FieldMeta`]: juniper::FieldMeta /// [`FieldMeta`]: juniper::FieldMeta
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
fn impl_field_meta_tokens(&self) -> TokenStream { fn impl_field_meta_tokens(&self) -> TokenStream {
let impl_ty = &self.ty; let impl_ty = &self.ty;
@ -622,7 +622,7 @@ impl Definition<Query> {
/// this [GraphQL object][1]. /// this [GraphQL object][1].
/// ///
/// [`Field`]: juniper::Field /// [`Field`]: juniper::Field
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
fn impl_field_tokens(&self) -> TokenStream { fn impl_field_tokens(&self) -> TokenStream {
let (impl_ty, scalar) = (&self.ty, &self.scalar); let (impl_ty, scalar) = (&self.ty, &self.scalar);
@ -695,7 +695,7 @@ impl Definition<Query> {
/// of this [GraphQL object][1]. /// of this [GraphQL object][1].
/// ///
/// [`AsyncField`]: juniper::AsyncField /// [`AsyncField`]: juniper::AsyncField
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
fn impl_async_field_tokens(&self) -> TokenStream { fn impl_async_field_tokens(&self) -> TokenStream {
let (impl_ty, scalar) = (&self.ty, &self.scalar); let (impl_ty, scalar) = (&self.ty, &self.scalar);
@ -757,7 +757,7 @@ impl Definition<Query> {
/// [GraphQL object][1]. /// [GraphQL object][1].
/// ///
/// [`GraphQLValue`]: juniper::GraphQLValue /// [`GraphQLValue`]: juniper::GraphQLValue
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
fn impl_graphql_value_tokens(&self) -> TokenStream { fn impl_graphql_value_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -824,7 +824,7 @@ impl Definition<Query> {
/// [GraphQL object][1]. /// [GraphQL object][1].
/// ///
/// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync /// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[must_use] #[must_use]
fn impl_graphql_value_async_tokens(&self) -> TokenStream { fn impl_graphql_value_async_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;

View file

@ -1,6 +1,6 @@
//! Code generation for [GraphQL subscription][1]. //! Code generation for [GraphQL subscription][1].
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Subscription //! [1]: https://spec.graphql.org/October2021#sec-Subscription
pub mod attr; pub mod attr;
@ -13,7 +13,7 @@ use crate::{common::field, graphql_object::Definition};
/// [GraphQL subscription operation][2] of the [`Definition`] to generate code /// [GraphQL subscription operation][2] of the [`Definition`] to generate code
/// for. /// for.
/// ///
/// [2]: https://spec.graphql.org/June2018/#sec-Subscription /// [2]: https://spec.graphql.org/October2021#sec-Subscription
struct Subscription; struct Subscription;
impl ToTokens for Definition<Subscription> { impl ToTokens for Definition<Subscription> {
@ -31,7 +31,7 @@ impl Definition<Subscription> {
/// [GraphQL subscription][1]. /// [GraphQL subscription][1].
/// ///
/// [`GraphQLValue`]: juniper::GraphQLValue /// [`GraphQLValue`]: juniper::GraphQLValue
/// [1]: https://spec.graphql.org/June2018/#sec-Subscription /// [1]: https://spec.graphql.org/October2021#sec-Subscription
#[must_use] #[must_use]
fn impl_graphql_value_tokens(&self) -> TokenStream { fn impl_graphql_value_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -80,7 +80,7 @@ impl Definition<Subscription> {
/// for this [GraphQL subscription][1]. /// for this [GraphQL subscription][1].
/// ///
/// [`GraphQLSubscriptionValue`]: juniper::GraphQLSubscriptionValue /// [`GraphQLSubscriptionValue`]: juniper::GraphQLSubscriptionValue
/// [1]: https://spec.graphql.org/June2018/#sec-Subscription /// [1]: https://spec.graphql.org/October2021#sec-Subscription
#[must_use] #[must_use]
fn impl_graphql_subscription_value_tokens(&self) -> TokenStream { fn impl_graphql_subscription_value_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;

View file

@ -112,7 +112,7 @@ fn expand_on_trait(
/// On failure returns [`None`] and internally fills up [`proc_macro_error`] /// On failure returns [`None`] and internally fills up [`proc_macro_error`]
/// with the corresponding errors. /// with the corresponding errors.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
fn parse_variant_from_trait_method( fn parse_variant_from_trait_method(
method: &mut syn::TraitItemMethod, method: &mut syn::TraitItemMethod,
trait_ident: &syn::Ident, trait_ident: &syn::Ident,

View file

@ -98,7 +98,7 @@ fn expand_enum(ast: syn::DeriveInput) -> syn::Result<Definition> {
/// On failure returns [`None`] and internally fills up [`proc_macro_error`] /// On failure returns [`None`] and internally fills up [`proc_macro_error`]
/// with the corresponding errors. /// with the corresponding errors.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
fn parse_variant_from_enum_variant( fn parse_variant_from_enum_variant(
var: syn::Variant, var: syn::Variant,
enum_ident: &syn::Ident, enum_ident: &syn::Ident,

View file

@ -1,6 +1,6 @@
//! Code generation for [GraphQL union][1]. //! Code generation for [GraphQL union][1].
//! //!
//! [1]: https://spec.graphql.org/June2018/#sec-Unions //! [1]: https://spec.graphql.org/October2021#sec-Unions
pub mod attr; pub mod attr;
pub mod derive; pub mod derive;
@ -35,14 +35,14 @@ type AttrResolvers = HashMap<syn::Type, SpanContainer<syn::ExprPath>>;
/// Available arguments behind `#[graphql]` (or `#[graphql_union]`) attribute /// Available arguments behind `#[graphql]` (or `#[graphql_union]`) attribute
/// when generating code for [GraphQL union][1] type. /// when generating code for [GraphQL union][1] type.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[derive(Debug, Default)] #[derive(Debug, Default)]
struct Attr { struct Attr {
/// Explicitly specified name of [GraphQL union][1] type. /// Explicitly specified name of [GraphQL union][1] type.
/// ///
/// If [`None`], then Rust type name is used by default. /// If [`None`], then Rust type name is used by default.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
name: Option<SpanContainer<String>>, name: Option<SpanContainer<String>>,
/// Explicitly specified [description][2] of [GraphQL union][1] type. /// Explicitly specified [description][2] of [GraphQL union][1] type.
@ -50,8 +50,8 @@ struct Attr {
/// If [`None`], then Rust doc comment will be used as the [description][2], /// If [`None`], then Rust doc comment will be used as the [description][2],
/// if any. /// if any.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
/// [2]: https://spec.graphql.org/June2018/#sec-Descriptions /// [2]: https://spec.graphql.org/October2021#sec-Descriptions
description: Option<SpanContainer<String>>, description: Option<SpanContainer<String>>,
/// Explicitly specified type of [`Context`] to use for resolving this /// Explicitly specified type of [`Context`] to use for resolving this
@ -60,7 +60,7 @@ struct Attr {
/// If [`None`], then unit type `()` is assumed as a type of [`Context`]. /// If [`None`], then unit type `()` is assumed as a type of [`Context`].
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
context: Option<SpanContainer<syn::Type>>, context: Option<SpanContainer<syn::Type>>,
/// Explicitly specified type of [`ScalarValue`] to use for resolving this /// Explicitly specified type of [`ScalarValue`] to use for resolving this
@ -74,7 +74,7 @@ struct Attr {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
scalar: Option<SpanContainer<scalar::AttrValue>>, scalar: Option<SpanContainer<scalar::AttrValue>>,
/// Explicitly specified external resolver functions for [GraphQL union][1] /// Explicitly specified external resolver functions for [GraphQL union][1]
@ -85,7 +85,7 @@ struct Attr {
/// external resolver function has sense, when some custom [union][1] /// external resolver function has sense, when some custom [union][1]
/// variant resolving logic is involved, or variants cannot be inferred. /// variant resolving logic is involved, or variants cannot be inferred.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
external_resolvers: AttrResolvers, external_resolvers: AttrResolvers,
/// Indicator whether the generated code is intended to be used only inside /// Indicator whether the generated code is intended to be used only inside
@ -192,13 +192,13 @@ impl Attr {
/// Available arguments behind `#[graphql]` attribute when generating code for /// Available arguments behind `#[graphql]` attribute when generating code for
/// [GraphQL union][1]'s variant. /// [GraphQL union][1]'s variant.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[derive(Debug, Default)] #[derive(Debug, Default)]
struct VariantAttr { struct VariantAttr {
/// Explicitly specified marker for the variant/field being ignored and not /// Explicitly specified marker for the variant/field being ignored and not
/// included into [GraphQL union][1]. /// included into [GraphQL union][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
ignore: Option<SpanContainer<syn::Ident>>, ignore: Option<SpanContainer<syn::Ident>>,
/// Explicitly specified external resolver function for this [GraphQL union][1] variant. /// Explicitly specified external resolver function for this [GraphQL union][1] variant.
@ -207,7 +207,7 @@ struct VariantAttr {
/// Usually, specifying an external resolver function has sense, when some custom resolving /// Usually, specifying an external resolver function has sense, when some custom resolving
/// logic is involved. /// logic is involved.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
external_resolver: Option<SpanContainer<syn::ExprPath>>, external_resolver: Option<SpanContainer<syn::ExprPath>>,
} }
@ -259,22 +259,22 @@ impl VariantAttr {
/// Definition of [GraphQL union][1] for code generation. /// Definition of [GraphQL union][1] for code generation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
struct Definition { struct Definition {
/// Name of this [GraphQL union][1] in GraphQL schema. /// Name of this [GraphQL union][1] in GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
name: String, name: String,
/// Rust type that this [GraphQL union][1] is represented with. /// Rust type that this [GraphQL union][1] is represented with.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
ty: syn::Type, ty: syn::Type,
/// Generics of the Rust type that this [GraphQL union][1] is implemented /// Generics of the Rust type that this [GraphQL union][1] is implemented
/// for. /// for.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
generics: syn::Generics, generics: syn::Generics,
/// Indicator whether code should be generated for a trait object, rather /// Indicator whether code should be generated for a trait object, rather
@ -283,7 +283,7 @@ struct Definition {
/// Description of this [GraphQL union][1] to put into GraphQL schema. /// Description of this [GraphQL union][1] to put into GraphQL schema.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
description: Option<String>, description: Option<String>,
/// Rust type of [`Context`] to generate [`GraphQLType`] implementation with /// Rust type of [`Context`] to generate [`GraphQLType`] implementation with
@ -291,7 +291,7 @@ struct Definition {
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
context: syn::Type, context: syn::Type,
/// Rust type of [`ScalarValue`] to generate [`GraphQLType`] implementation /// Rust type of [`ScalarValue`] to generate [`GraphQLType`] implementation
@ -305,12 +305,12 @@ struct Definition {
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
scalar: scalar::Type, scalar: scalar::Type,
/// Variants definitions of this [GraphQL union][1]. /// Variants definitions of this [GraphQL union][1].
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
variants: Vec<VariantDefinition>, variants: Vec<VariantDefinition>,
} }
@ -334,7 +334,7 @@ impl Definition {
/// ///
/// [`GraphQLAsyncValue`]: juniper::GraphQLAsyncValue /// [`GraphQLAsyncValue`]: juniper::GraphQLAsyncValue
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
fn impl_generics( fn impl_generics(
&self, &self,
@ -411,7 +411,7 @@ impl Definition {
/// [GraphQL union][1]. /// [GraphQL union][1].
/// ///
/// [`GraphQLUnion`]: juniper::GraphQLUnion /// [`GraphQLUnion`]: juniper::GraphQLUnion
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
fn impl_graphql_union_tokens(&self) -> TokenStream { fn impl_graphql_union_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -439,7 +439,7 @@ impl Definition {
/// this [GraphQL union][1]. /// this [GraphQL union][1].
/// ///
/// [`marker::IsOutputType`]: juniper::marker::IsOutputType /// [`marker::IsOutputType`]: juniper::marker::IsOutputType
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
fn impl_output_type_tokens(&self) -> TokenStream { fn impl_output_type_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -463,7 +463,7 @@ impl Definition {
/// [GraphQL union][1]. /// [GraphQL union][1].
/// ///
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
fn impl_graphql_type_tokens(&self) -> TokenStream { fn impl_graphql_type_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -507,7 +507,7 @@ impl Definition {
/// [GraphQL union][1]. /// [GraphQL union][1].
/// ///
/// [`GraphQLValue`]: juniper::GraphQLValue /// [`GraphQLValue`]: juniper::GraphQLValue
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
fn impl_graphql_value_tokens(&self) -> TokenStream { fn impl_graphql_value_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -574,7 +574,7 @@ impl Definition {
/// [GraphQL union][1]. /// [GraphQL union][1].
/// ///
/// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync /// [`GraphQLValueAsync`]: juniper::GraphQLValueAsync
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
fn impl_graphql_value_async_tokens(&self) -> TokenStream { fn impl_graphql_value_async_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -618,7 +618,7 @@ impl Definition {
/// [`BaseSubTypes`]: juniper::macros::reflect::BaseSubTypes /// [`BaseSubTypes`]: juniper::macros::reflect::BaseSubTypes
/// [`BaseType`]: juniper::macros::reflect::BaseType /// [`BaseType`]: juniper::macros::reflect::BaseType
/// [`WrappedType`]: juniper::macros::reflect::WrappedType /// [`WrappedType`]: juniper::macros::reflect::WrappedType
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
#[must_use] #[must_use]
pub(crate) fn impl_reflection_traits_tokens(&self) -> TokenStream { pub(crate) fn impl_reflection_traits_tokens(&self) -> TokenStream {
let scalar = &self.scalar; let scalar = &self.scalar;
@ -659,22 +659,22 @@ impl Definition {
/// Definition of [GraphQL union][1] variant for code generation. /// Definition of [GraphQL union][1] variant for code generation.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
struct VariantDefinition { struct VariantDefinition {
/// Rust type that this [GraphQL union][1] variant resolves into. /// Rust type that this [GraphQL union][1] variant resolves into.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
ty: syn::Type, ty: syn::Type,
/// Rust code for value resolution of this [GraphQL union][1] variant. /// Rust code for value resolution of this [GraphQL union][1] variant.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
resolver_code: syn::Expr, resolver_code: syn::Expr,
/// Rust code for checking whether [GraphQL union][1] should be resolved /// Rust code for checking whether [GraphQL union][1] should be resolved
/// into this variant. /// into this variant.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
resolver_check: syn::Expr, resolver_check: syn::Expr,
/// Rust type of [`Context`] that this [GraphQL union][1] variant requires /// Rust type of [`Context`] that this [GraphQL union][1] variant requires
@ -684,7 +684,7 @@ struct VariantDefinition {
/// trait method contains context argument. /// trait method contains context argument.
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
context: Option<syn::Type>, context: Option<syn::Type>,
} }
@ -763,7 +763,7 @@ impl VariantDefinition {
/// If duplication happens, then resolving code is overwritten with the one from /// If duplication happens, then resolving code is overwritten with the one from
/// `external_resolvers`. /// `external_resolvers`.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
fn emerge_union_variants_from_attr( fn emerge_union_variants_from_attr(
variants: &mut Vec<VariantDefinition>, variants: &mut Vec<VariantDefinition>,
external_resolvers: AttrResolvers, external_resolvers: AttrResolvers,
@ -810,7 +810,7 @@ fn emerge_union_variants_from_attr(
/// used to enforce this requirement in the generated code. However, due to the /// used to enforce this requirement in the generated code. However, due to the
/// bad error message this implementation should stay and provide guidance. /// bad error message this implementation should stay and provide guidance.
/// ///
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
/// [2]: juniper::sa::assert_type_ne_all /// [2]: juniper::sa::assert_type_ne_all
fn all_variants_different(variants: &[VariantDefinition]) -> bool { fn all_variants_different(variants: &[VariantDefinition]) -> bool {
let mut types: Vec<_> = variants.iter().map(|var| &var.ty).collect(); let mut types: Vec<_> = variants.iter().map(|var| &var.ty).collect();

View file

@ -1287,8 +1287,8 @@ pub fn derive_scalar_value(input: TokenStream) -> TokenStream {
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [`Executor`]: juniper::Executor /// [`Executor`]: juniper::Executor
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [0]: https://spec.graphql.org/June2018 /// [0]: https://spec.graphql.org/October2021
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
/// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety /// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety
/// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html /// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html
/// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html /// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html
@ -1328,7 +1328,7 @@ pub fn graphql_interface(attr: TokenStream, body: TokenStream) -> TokenStream {
/// For more info and possibilities see [`#[graphql_interface]`] macro. /// For more info and possibilities see [`#[graphql_interface]`] macro.
/// ///
/// [`#[graphql_interface]`]: crate::graphql_interface /// [`#[graphql_interface]`]: crate::graphql_interface
/// [1]: https://spec.graphql.org/June2018/#sec-Interfaces /// [1]: https://spec.graphql.org/October2021#sec-Interfaces
#[proc_macro_error] #[proc_macro_error]
#[proc_macro_derive(GraphQLInterface, attributes(graphql))] #[proc_macro_derive(GraphQLInterface, attributes(graphql))]
pub fn derive_interface(body: TokenStream) -> TokenStream { pub fn derive_interface(body: TokenStream) -> TokenStream {
@ -1465,7 +1465,7 @@ pub fn derive_interface(body: TokenStream) -> TokenStream {
/// ``` /// ```
/// ///
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[proc_macro_error] #[proc_macro_error]
#[proc_macro_derive(GraphQLObject, attributes(graphql))] #[proc_macro_derive(GraphQLObject, attributes(graphql))]
pub fn derive_object(body: TokenStream) -> TokenStream { pub fn derive_object(body: TokenStream) -> TokenStream {
@ -1789,8 +1789,8 @@ pub fn derive_object(body: TokenStream) -> TokenStream {
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`GraphQLValue`]: juniper::GraphQLValue /// [`GraphQLValue`]: juniper::GraphQLValue
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [0]: https://spec.graphql.org/June2018 /// [0]: https://spec.graphql.org/October2021
/// [1]: https://spec.graphql.org/June2018/#sec-Objects /// [1]: https://spec.graphql.org/October2021#sec-Objects
#[proc_macro_error] #[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_object(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_object(attr: TokenStream, body: TokenStream) -> TokenStream {
@ -1843,7 +1843,7 @@ pub fn graphql_object(attr: TokenStream, body: TokenStream) -> TokenStream {
/// [`GraphQLType`]: juniper::GraphQLType /// [`GraphQLType`]: juniper::GraphQLType
/// [`GraphQLSubscriptionValue`]: juniper::GraphQLSubscriptionValue /// [`GraphQLSubscriptionValue`]: juniper::GraphQLSubscriptionValue
/// [`Stream`]: futures::Stream /// [`Stream`]: futures::Stream
/// [1]: https://spec.graphql.org/June2018/#sec-Subscription /// [1]: https://spec.graphql.org/October2021#sec-Subscription
#[proc_macro_error] #[proc_macro_error]
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn graphql_subscription(attr: TokenStream, body: TokenStream) -> TokenStream { pub fn graphql_subscription(attr: TokenStream, body: TokenStream) -> TokenStream {
@ -2150,7 +2150,7 @@ pub fn graphql_subscription(attr: TokenStream, body: TokenStream) -> TokenStream
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
/// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html /// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html
#[proc_macro_error] #[proc_macro_error]
#[proc_macro_derive(GraphQLUnion, attributes(graphql))] #[proc_macro_derive(GraphQLUnion, attributes(graphql))]
@ -2440,7 +2440,7 @@ pub fn derive_union(body: TokenStream) -> TokenStream {
/// ///
/// [`Context`]: juniper::Context /// [`Context`]: juniper::Context
/// [`ScalarValue`]: juniper::ScalarValue /// [`ScalarValue`]: juniper::ScalarValue
/// [1]: https://spec.graphql.org/June2018/#sec-Unions /// [1]: https://spec.graphql.org/October2021#sec-Unions
/// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety /// [2]: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety
/// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html /// [3]: https://doc.rust-lang.org/stable/reference/types/trait-object.html
/// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html /// [4]: https://doc.rust-lang.org/stable/std/primitive.unit.html

View file

@ -5,8 +5,8 @@ use std::fmt;
use proc_macro2::Span; use proc_macro2::Span;
use proc_macro_error::{Diagnostic, Level}; use proc_macro_error::{Diagnostic, Level};
/// URL of the GraphQL specification (June 2018 Edition). /// URL of the GraphQL specification (October 2021 Edition).
pub const SPEC_URL: &str = "https://spec.graphql.org/June2018/"; pub const SPEC_URL: &str = "https://spec.graphql.org/October2021";
pub enum GraphQLScope { pub enum GraphQLScope {
EnumDerive, EnumDerive,

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | enum __Test { 4 | enum __Test {
| ^^^^^^ | ^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL enum no fields allowed for non-ignored variants
5 | Variant(i32), 5 | Variant(i32),
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Enums = note: https://spec.graphql.org/October2021#sec-Enums

View file

@ -5,4 +5,4 @@ error: All types and directives defined within a schema must not have a name whi
6 | | test: String, 6 | | test: String,
| |________________^ | |________________^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
5 | __id: String, 5 | __id: String,
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -9,4 +9,4 @@ error: GraphQL interface must have a different name for each field
9 | | } 9 | | }
| |_^ | |_^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | struct __Character { 4 | struct __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL interface must have at least one field
4 | struct Character {} 4 | struct Character {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: GraphQL interface expected named struct field
4 | struct Character(i32); 4 | struct Character(i32);
| ^^^ | ^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
5 | __id: String, 5 | __id: String,
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -9,4 +9,4 @@ error: GraphQL interface must have a different name for each field
9 | | } 9 | | }
| |_^ | |_^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | struct __Character { 4 | struct __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL interface must have at least one field
4 | struct Character {} 4 | struct Character {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: GraphQL interface expected named struct field
4 | struct Character(i32); 4 | struct Character(i32);
| ^^^ | ^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
5 | fn id(&self, __num: i32) -> &str; 5 | fn id(&self, __num: i32) -> &str;
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
5 | fn __id(&self) -> &str; 5 | fn __id(&self) -> &str;
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -9,4 +9,4 @@ error: GraphQL interface must have a different name for each field
9 | | } 9 | | }
| |_^ | |_^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -7,4 +7,4 @@ error: GraphQL interface trait method can't have default implementation
7 | | } 7 | | }
| |_____^ | |_____^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | trait __Character { 4 | trait __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL interface must have at least one field
4 | trait Character {} 4 | trait Character {}
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Interfaces = note: https://spec.graphql.org/October2021#sec-Interfaces

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
7 | fn id(&self, __num: i32) -> &str { 7 | fn id(&self, __num: i32) -> &str {
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL object must have a different name for each field
6 | impl ObjA { 6 | impl ObjA {
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
6 | impl __Obj { 6 | impl __Obj {
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL object must have at least one field
6 | impl Obj {} 6 | impl Obj {}
| ^^^ | ^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
5 | __test: String, 5 | __test: String,
| ^^^^^^ | ^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -8,4 +8,4 @@ error: GraphQL object must have a different name for each field
8 | | } 8 | | }
| |_^ | |_^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | struct __Obj { 4 | struct __Obj {
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL object must have at least one field
4 | struct Obj {} 4 | struct Obj {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
11 | async fn id(&self, __num: i32) -> Stream<'static, &'static str> { 11 | async fn id(&self, __num: i32) -> Stream<'static, &'static str> {
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,5 +4,5 @@ error: GraphQL object synchronous resolvers are not supported
11 | fn id(&self) -> Stream<'static, bool> { 11 | fn id(&self) -> Stream<'static, bool> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects
= note: Specify that this function is async: `async fn foo()` = note: Specify that this function is async: `async fn foo()`

View file

@ -4,4 +4,4 @@ error: GraphQL object must have a different name for each field
10 | impl ObjA { 10 | impl ObjA {
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
10 | impl __Obj { 10 | impl __Obj {
| ^^^^^ | ^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL object must have at least one field
6 | impl Obj {} 6 | impl Obj {}
| ^^^ | ^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Objects = note: https://spec.graphql.org/October2021#sec-Objects

View file

@ -4,4 +4,4 @@ error: GraphQL union variant `Human` already has external resolver function `res
6 | #[graphql(with = resolve_fn2)] 6 | #[graphql(with = resolve_fn2)]
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | enum __Character { 4 | enum __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL union expects at least one union variant
4 | enum Character {} 4 | enum Character {}
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -7,4 +7,4 @@ error: GraphQL union must have a different type for each union variant
7 | | } 7 | | }
| |_^ | |_^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -4,7 +4,7 @@ error: GraphQL union enum allows only unnamed variants with a single field, e.g.
5 | A { human: Human }, 5 | A { human: Human },
| ^ | ^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions
error: GraphQL union enum allows only unnamed variants with a single field, e.g. `Some(T)` error: GraphQL union enum allows only unnamed variants with a single field, e.g. `Some(T)`
--> fail/union/enum_wrong_variant_field.rs:10:6 --> fail/union/enum_wrong_variant_field.rs:10:6
@ -12,4 +12,4 @@ error: GraphQL union enum allows only unnamed variants with a single field, e.g.
10 | A(Human, u8), 10 | A(Human, u8),
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
5 | struct __Character; 5 | struct __Character;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL union expects at least one union variant
4 | struct Character; 4 | struct Character;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -4,5 +4,5 @@ error: GraphQL union trait method `a` conflicts with the external resolver funct
5 | fn a(&self) -> Option<&Human>; 5 | fn a(&self) -> Option<&Human>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions
= note: use `#[graphql(ignore)]` attribute to ignore this trait method for union variants resolution = note: use `#[graphql(ignore)]` attribute to ignore this trait method for union variants resolution

View file

@ -4,4 +4,4 @@ error: All types and directives defined within a schema must not have a name whi
4 | trait __Character { 4 | trait __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Schema = note: https://spec.graphql.org/October2021#sec-Schema

View file

@ -4,4 +4,4 @@ error: GraphQL union expects at least one union variant
4 | trait Character {} 4 | trait Character {}
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -7,4 +7,4 @@ error: GraphQL union must have a different type for each union variant
7 | | } 7 | | }
| |_^ | |_^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -4,5 +4,5 @@ error: GraphQL union cannot use #[graphql(with = ...)] attribute on a trait meth
5 | #[graphql(with = something)] 5 | #[graphql(with = something)]
| ^^^^ | ^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions
= note: instead use #[graphql(ignore)] on the method with #[graphql_union(on ... = ...)] on the trait itself = note: instead use #[graphql(ignore)] on the method with #[graphql_union(on ... = ...)] on the trait itself

View file

@ -4,4 +4,4 @@ error: GraphQL union expects trait method to accept `&self` only and, optionally
5 | fn a(&self, ctx: &(), rand: u8) -> Option<&Human>; 5 | fn a(&self, ctx: &(), rand: u8) -> Option<&Human>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions

View file

@ -4,4 +4,4 @@ error: GraphQL union expects trait method return type to be `Option<&VariantType
5 | fn a(&self) -> &Human; 5 | fn a(&self) -> &Human;
| ^^^^^^ | ^^^^^^
| |
= note: https://spec.graphql.org/June2018/#sec-Unions = note: https://spec.graphql.org/October2021#sec-Unions