|
2 | 2 |
|
3 | 3 | ## Features
|
4 | 4 |
|
5 |
| -- Added support for outputting the Rust schema in the [GraphQL Schema Language](https://graphql.org/learn/schema/#type-language). ([#676](https://github.com/graphql-rust/juniper/pull/676)) |
6 |
| - - This is controlled by the `schema-language` feature and is on by default. It may be turned off if you do not need this functionality to reduce dependencies and speed up compile times. |
| 5 | +- Added async support. ([#2](https://github.com/graphql-rust/juniper/issues/2)) |
| 6 | + - `execute()` is now async. Synchronous execution can still be used via `execute_sync()`. |
| 7 | + - Field resolvers may optionally be declared as `async` and return a future. |
7 | 8 |
|
8 |
| -- Normalization for the subscriptions_endpoint_url in the `graphiql_source`. |
9 |
| -(See [#628](https://github.com/graphql-rust/juniper/pull/628) for more details) |
10 |
| - |
11 |
| -- Support raw identifiers in field and argument names. (`#[object]` macro) |
| 9 | +- Added *experimental* support for GraphQL subscriptions. ([#433](https://github.com/graphql-rust/juniper/pull/433)) |
12 | 10 |
|
13 |
| -- Most error types now implement `std::error::Error`: |
| 11 | +- Added support for generating the [GraphQL Schema Language](https://graphql.org/learn/schema/#type-language) representation of a schema using `RootNode::as_schema_language()`. ([#676](https://github.com/graphql-rust/juniper/pull/676)) |
| 12 | + - This is controlled by the `schema-language` feature and is on by default. It may be turned off if you do not need this functionality to reduce dependencies and speed up compile times. |
| 13 | + - Note that this is for generating the GraphQL Schema Language representation from the Rust schema. For the opposite--generating a Rust schema from a GraphQL Schema Language file--see the [`juniper_from_schema`](https://github.com/davidpdrsn/juniper-from-schema) project. |
| 14 | + |
| 15 | +- Most GraphQL spec violations are now caught at compile-time. ([#631](https://github.com/graphql-rust/juniper/pull/631)) |
| 16 | + - The enhanced error messages now include the reason and a link to the spec. |
| 17 | + For example, if you try to declare a GraphQL object with no fields: |
| 18 | + ```rust |
| 19 | + error: GraphQL object expects at least one field |
| 20 | + --> $DIR/impl_no_fields.rs:4:1 |
| 21 | + | |
| 22 | + 4 | impl Object {} |
| 23 | + | ^^^^^^^^^^^^^^ |
| 24 | + | |
| 25 | + = note: https://spec.graphql.org/June2018/#sec-Objects |
| 26 | + ``` |
| 27 | + |
| 28 | +- [Raw identifiers](https://doc.rust-lang.org/edition-guide/rust-2018/module-system/raw-identifiers.html) are now supported in field and argument names. |
| 29 | + |
| 30 | +- Most error types now implement `std::error::Error`. ([#419](https://github.com/graphql-rust/juniper/pull/419)) |
14 | 31 | - `GraphQLError`
|
15 | 32 | - `LexerError`
|
16 | 33 | - `ParseError`
|
17 | 34 | - `RuleError`
|
18 | 35 |
|
19 |
| -- Support subscriptions (see |
20 |
| - [#433](https://github.com/graphql-rust/juniper/pull/433) for more details) |
21 |
| - |
22 |
| -See [#419](https://github.com/graphql-rust/juniper/pull/419). |
23 |
| - |
24 |
| -- `SchemaType` is now public |
25 |
| - - This is helpful when using `context.getSchema()` inside of your field resolvers |
26 |
| - |
27 |
| -- Support subscriptions in GraphiQL |
28 |
| - |
29 |
| -See [#569](https://github.com/graphql-rust/juniper/pull/569). |
| 36 | +## Fixes |
30 | 37 |
|
31 |
| -- GraphQLUnion derive support ("#[derive(GraphqQLUnion)]") |
32 |
| - - implements GraphQLAsyncType |
33 |
| - |
34 |
| -See [#618](https://github.com/graphql-rust/juniper/pull/618). |
35 |
| - |
36 |
| -- Derive macro `GraphQLEnum` supports custom context (see [#621](https://github.com/graphql-rust/juniper/pull/621)) |
37 |
| - |
38 |
| -- Reworked `#[derive(GraphQLUnion)]` macro ([#666]): |
39 |
| - - Applicable to enums and structs. |
40 |
| - - Supports custom resolvers. |
41 |
| - - Supports generics. |
42 |
| - - Supports multiple `#[graphql]` attributes. |
43 |
| -- New `#[graphql_union]` macro ([#666]): |
| 38 | +- Massively improved the `#[graphql_union]` proc macro. ([#666](https://github.com/graphql-rust/juniper/pull/666)): |
44 | 39 | - Applicable to traits.
|
45 | 40 | - Supports custom resolvers.
|
46 | 41 | - Supports generics.
|
47 | 42 | - Supports multiple `#[graphql_union]` attributes.
|
48 | 43 |
|
49 |
| -- Better error messages for all proc macros (see |
50 |
| - [#631](https://github.com/graphql-rust/juniper/pull/631) |
| 44 | +- Massively improved the `#[derive(GraphQLUnion)]` macro. ([#666](https://github.com/graphql-rust/juniper/pull/666)): |
| 45 | + - Applicable to enums and structs. |
| 46 | + - Supports custom resolvers. |
| 47 | + - Supports generics. |
| 48 | + - Supports multiple `#[graphql]` attributes. |
| 49 | + |
| 50 | + - The `GraphQLEnum` derive now supports specifying a custom context. ([#621](https://github.com/graphql-rust/juniper/pull/621)) |
| 51 | + - Example: |
| 52 | + ```rust |
| 53 | + #[derive(juniper::GraphQLEnum)] |
| 54 | + #[graphql(context = CustomContext)] |
| 55 | + enum TestEnum { |
| 56 | + A, |
| 57 | + } |
| 58 | + ``` |
| 59 | + |
| 60 | +- Added support for renaming arguments within a GraphQL object. ([#631](https://github.com/graphql-rust/juniper/pull/631)) |
| 61 | + - Example: |
| 62 | + ```rust |
| 63 | + #[graphql(arguments(argA(name = "test")))] |
| 64 | + ``` |
| 65 | + |
| 66 | +- `SchemaType` is now public. |
| 67 | + - This is helpful when using `context.getSchema()` inside of your field resolvers. |
51 | 68 |
|
52 |
| -- Improved lookahead visibility for aliased fields (see [#662](https://github.com/graphql-rust/juniper/pull/662)) |
| 69 | +- Improved lookahead visibility for aliased fields. ([#662](https://github.com/graphql-rust/juniper/pull/662)) |
53 | 70 |
|
54 |
| -- Bumped bson crate's version to 1.0.0 (see [#678](https://github.com/graphql-rust/juniper/pull/678)) |
| 71 | +- When enabled, the optional `bson` integration now requires `bson-1.0.0`. ([#678](https://github.com/graphql-rust/juniper/pull/678)) |
55 | 72 |
|
56 | 73 | ## Breaking Changes
|
57 | 74 |
|
58 |
| -- `GraphQLType` trait was split into 2 traits: ([#685]) |
59 |
| - - object safe `GraphQLValue` trait containing resolving logic; |
60 |
| - - static `GraphQLType` trait containing GraphQL type information. |
| 75 | +- `GraphQLType` trait was split into 2 traits: ([#685](https://github.com/graphql-rust/juniper/pull/685)) |
| 76 | + - object safe `GraphQLValue` trait containing resolving logic; |
| 77 | + - static `GraphQLType` trait containing GraphQL type information. |
| 78 | + |
| 79 | +- `juniper::graphiql` has moved to `juniper::http::graphiql`. |
| 80 | + - `juniper::http::graphiql::graphiql_source()` now requires a second parameter for subscriptions. |
| 81 | + |
| 82 | +- Renamed the `object` proc macro to `graphql_object`. |
| 83 | +- Removed the `graphql_object!` macro. Use the `#[graphql_object]` proc macro instead. |
61 | 84 |
|
62 |
| -- `juniper::graphiql` has moved to `juniper::http::graphiql` |
63 |
| - - `juniper::http::graphiql::graphiql_source` now requies a second parameter for subscriptions |
| 85 | +- Renamed the `scalar` proc macro to `graphql_scalar`. |
| 86 | +- Removed the `graphql_scalar!` macro. Use the `#[graphql_scalar]` proc macro instead. |
64 | 87 |
|
65 |
| -- remove old `graphql_object!` macro, rename `object` proc macro to `graphql_object` |
| 88 | +- Removed the deprecated `ScalarValue` custom derive. Use `GraphQLScalarValue` instead. |
66 | 89 |
|
67 |
| -- remove old `graphql_scalar!` macro, rename `scalar` proc macro to `graphql_scalar` |
| 90 | +- Removed the `graphql_union!` macro. Use the `#[graphql_union]` proc macro or custom resolvers for the `#[derive(GraphQLUnion)]` instead. |
68 | 91 |
|
69 |
| -- Remove deprecated `ScalarValue` custom derive (renamed to GraphQLScalarValue) |
| 92 | +- The `#[derive(GraphQLUnion)]` macro no longer generates `From` impls for enum variants. ([#666](https://github.com/graphql-rust/juniper/pull/666)) |
| 93 | + - Consider using the [`derive_more`](https//docs.rs/derive_more) crate directly. |
70 | 94 |
|
71 |
| -- `graphql_union!` macro removed, replaced by `#[graphql_union]` proc macro and custom resolvers for the `#[derive(GraphQLUnion)]` macro. |
72 |
| -- The `#[derive(GraphQLUnion)]` macro doesn't generate `From` impls for enum variants anymore. Consider using the [`derive_more`](https//docs.rs/derive_more) crate directly ([#666]). |
| 95 | +- The `ScalarRefValue` trait has been removed as it was not required. |
73 | 96 |
|
74 |
| -- `ScalarRefValue` trait removed. Trait was not required. |
| 97 | +- Prefixing variables or fields with an underscore now matches Rust's behavior. ([#684](https://github.com/graphql-rust/juniper/pull/684)) |
75 | 98 |
|
76 |
| -- Changed return type of GraphQLType::resolve to `ExecutionResult` |
77 |
| - This was done to unify the return type of all resolver methods |
78 |
| - The previous `Value` return type was just an internal artifact of |
| 99 | +- The return type of `GraphQLType::resolve()` has been changed to `ExecutionResult`. |
| 100 | + - This was done to unify the return type of all resolver methods. The previous `Value` return type was just an internal artifact of |
79 | 101 | error handling.
|
80 | 102 |
|
81 | 103 | - Subscription-related:
|
82 |
| - add subscription type to `RootNode`, |
83 |
| - add subscription endpoint to `playground_source()` |
84 |
| - |
85 |
| -- Putting a scalar type into a string is not allowed anymore, e.g. |
86 |
| - `#[graphql(scalar = "DefaultScalarValue")]`. Only |
87 |
| - `#[derive(GraphQLInputObject)]` supported this syntax. The |
88 |
| - refactoring of GraphQLInputObject allowed to drop the support |
89 |
| - (see [#631](https://github.com/graphql-rust/juniper/pull/631)). |
| 104 | + - Add subscription type to `RootNode`. |
| 105 | + - Add subscription endpoint to `playground_source()`. |
| 106 | + - Add subscription endpoint to `graphiql_source()`. |
90 | 107 |
|
91 |
| -- Support for renaming arguments within an GraphQL object |
92 |
| - `#[graphql(arguments(argA(name = "test")))]` |
93 |
| - (see [#631](https://github.com/graphql-rust/juniper/pull/631)) |
| 108 | +- Specifying a scalar type via a string is no longer supported. ([#631](https://github.com/graphql-rust/juniper/pull/631)) |
| 109 | + - For example, instead of `#[graphql(scalar = "DefaultScalarValue")]` use `#[graphql(scalar = DefaultScalarValue)]`. *Note the lack of quotes*. |
94 | 110 |
|
95 | 111 | - Integration tests:
|
96 |
| - Rename `http::tests::HTTPIntegration` as `http::tests::HttpIntegration` |
97 |
| - and add support for `application/graphql` POST request. |
98 |
| - |
99 |
| -- When using LookAheadMethods to access child selections, children are always found using their alias if it exists rather than their name (see [#662](https://github.com/graphql-rust/juniper/pull/662)). These methods are also deprecated in favour of the new `children` method. |
| 112 | + - Renamed `http::tests::HTTPIntegration` as `http::tests::HttpIntegration`. |
| 113 | + - Added support for `application/graphql` POST request. |
100 | 114 |
|
101 |
| -[#666]: https://github.com/graphql-rust/juniper/pull/666 |
102 |
| -[#685]: https://github.com/graphql-rust/juniper/pull/685 |
| 115 | +- When using `LookAheadMethods` to access child selections, children are always found using their alias if it exists rather than their name. ([#662](https://github.com/graphql-rust/juniper/pull/662)) |
| 116 | + - These methods are also deprecated in favor of the new `LookAheadMethods::children()` method. |
103 | 117 |
|
104 | 118 | # [[0.14.2] 2019-12-16](https://github.com/graphql-rust/juniper/releases/tag/juniper-0.14.2)
|
105 | 119 |
|
|
0 commit comments