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