- preserve and reuse defined impl blocks in #[graphql_object] and #[graphql_subscription] macros expansion
- allow renaming `ScalarValue` type parameter in expanded code via `scalar = S: ScalarValue` syntax
Additionally:
- rename `rename` attribute's argument to `rename_all`
- support `rename_all` in #[graphql_interface] macro
Seems like the example code in the quickstart guide is missing an use declaration.
The code fails to compile: `error: cannot find macro `graphql_value` in this scope` with `rustc 1.48.0 (7eac88abb 2020-11-16)`
- reimplement #[derive(GraphQLUnion)] macro to support:
- both structs and enums
- generics in type definition
- multiple #[graphql] attributes
- external resolver functions
- remove From trait impls generation for enum variants
- reimplement #[graphql_union] macro to support:
- traits
- generics in trait definition
- multiple attributes
- external resolver functions
- GraphQLType implemetation for a raw trait object
- GraphQLTypeAsync implemetation (#549)
- add marker::GraphQLUnion trait
- rewrite "2.5 Unions" section in Book (Juniper user documentation)
- rewrite `codegen` and `codegen_fail` integration tests for GraphQL unions
Additionally:
- re-export `futures` crate in `juniper` for convenient reuse in the generated code without requiring library user to provide `futures` crate by himself (#663)
- use unit type () as default context for EmptyMutation and EmptySubscriptions
- relax Sized trait bound on some GraphQLType and GraphQLTypeAsync definitions, implementations and usages
* Added alternative error handling
* Fixed book tests and some sentences
* Apply suggestions from code review
Co-Authored-By: Christian Legnitto <LegNeato@users.noreply.github.com>
* Fixed book examples
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
Fixes#571
Signed-off-by: andrisak <andrisak@gmail.com>
* Replaced the old macro with the new proc macro.
Updated documentation.
Signed-off-by: andrisak <andrisak@gmail.com>
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
* Updated implementation of derive enum
- allows context specification
- allows scalar specification
- shares code with derive object
* Added this feature to CHANGELOG
* Added matrix with supported macro attributes for enums
* Added case which checks for custom context
* GraphQLUnion now can use a different context per variant
* Moved context switch test for union into right folder
* Sync resolve expression has the same form as the other impls
* Disabled custom scalar on GraphQLEnum
* Fixed CHANGELOG
* Fixed support matrix of GraphQLEnum in the book
- scalar not supported!
- skip not supported!
* Added test case for "noasync" derive attribute
* Disallowed generics and lifetimes on GraphQLEnum
* Added error message for duplicate naming
* Added error message for empty variant
* Implemented device macro for GraphQLUnion's
* Updated PR link in CHNAGELOG
* Disabled documentation on enumeration fields
* Disabled skip on fields
* Changed implementation for std::convert::Into since skip is not possible
* Added documentation for GraphQLUnion
* Added tests for GraphQLUnion
* Fixed typos in error messages (as suggested by review)
* Fixed failing documentation example
* Utilized `resolver_code` in `util::GraphQLTypeDefinitionField`.
Simplifies code and provides the idea of using
`util::GraphQLTypeDefinitionField` for different types than objects.
* Removed wrong statement about skip annotation in docs.
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
There's a comment [here](https://docs.rs/juniper/0.14.2/juniper/attr.object.html) that only GraphQL fields can be specified in `#[juniper::object]` impl block, yet in the book it was not specified, I needed help to get the idea to try it.
I simply copied that information because it feels important.
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
* Remove duplicate link to Hyper integration
The `Adding a Server` page contains a duplicate link to `Hyper`. The first of them can cause the reader to accidentally skip the `Rocket` and `Iron` integration pages because their pages are before the one for `Hyper` in the reading order.
Remove the first link so that the list of official server integrations matches the page order.
* Match the list of integrations to the page order
In the book, the pages for the official integrations appear in the order: `Warp`, `Rocket`, `Iron`, `Hyper`, but on the `Official Server Integrations` page they are listed with `Hyper` first. This can cause readers to accidentally skip the other three integrations if they click on the link for `Hyper` first.
Move `Hyper` to the bottom of the list to match the reading order of the book.
* Remove unnecessary blank line