I noticed that `juniper` fails to build if the `"expose-test-schema"` feature is enabled without also enabling `"serde_json"`. I guess it might make sense to add it as a dependency so people don't have to check this file to figure that out!
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
* Implement `std::error::Error` for all error types
* Fix copy-paste
* Implement `Display` for `Value`
This is required for implementing `Display` for `FieldError`
* Implement `std::error::Error` for `FieldError`
This required removing `impl From<T> for FieldError where T: Display`
because it would otherwise cause a conflicting implementation. That is
because `impl From<T> for T` already exists.
Instead I added `impl From<String> for FieldError` and `impl From<&str>
for FieldError` which should cover most use cases of the previous
`impl`. I also added `FieldError::from_error` so users can convert
from any error they may have.
* Bring back `impl<T: Display, S> From<T> for FieldError<S>`
We cannot have this and `impl<S> std::error::Error for FieldError<S>` so
we agreed this is more valuable. More context https://github.com/graphql-rust/juniper/pull/419
* Write errors without allocations
Fixes https://github.com/graphql-rust/juniper/issues/534.
I am not sure if the best way is to have folks bring their own futures for the
derives / macros or to pull it in as a dep explicitly like I have done here.
Because people are filing issues, we will do it this way and see what other issues arise.