Fields can now be skipped with the `#[graphql(skip)]` annotation. Note this
doesn't really make sense for GraphQLInputObjects so this isn't supported there.
Fixes https://github.com/graphql-rust/juniper/issues/220.
This enables Rust2018-style macro imports:
```rust
use juniper::graphql_object;
graphql_object!(User: () |&self| { ... });
```
In the future when dropping compatibility with pre-2018 compilers,
this can be replaced with the explicit `$crate` prefixes instead of
`local_inner_macros`.
In `macro_rules!` with the annotation `local_inner_macros`, all of macro calls
are transformed into `$crate::builtin!(...)` (See [1] for details).
Therefore, name resolutions of built-in macros are not perfomed correctly.
To avoid this, some helper macros are introduced to make built-in
macros be interpreted as crate-local macros.
[1]: https://github.com/rust-lang/rust/issues/53464#issuecomment-414049821
Performance improvements
* Replace the IndexMap in the serialized object with a plain
`Vec<(String, Value)>` because linear search is faster for few
elements
* Some general tweaks to skip some allocations
It appears with newer 0.10.x hyper it no longer takes "{" or "}" in the
query string unescaped.
When I tried to set `juniper_iron` to an older hyper it complained that it
couldn't resolve due to `juniper_rocket` needing a newer version.
This was the path of least resistance. Note that we are still testing the same
thing, this change is needed as a consequence of how `iron_test` creates mock
requests.
Fixes https://github.com/graphql-rust/juniper/issues/206
* Added trait to convert a custom error type into a FieldError
* Convert the error type of the gql fields if it implements IntoFieldError
* Added test case to check if custom error handling works
* Added to changelog
GraphQL spec requires every error contain `{"message": "field"}`. Every
error in juniper except ones fixed here are reported consistently with
this style. This commit fixes ones left.
If a field has a description, we properly generate a meta field definition like:
```rust
{
let field = registry.field::<String>("id", &());
let field = field.description("Whatever");
field
}
```
If a field does not have a description, we were generating something like:
```rust
{
let field = registry.field::<String>("id", &());
let field = field; // <--- Note not needed
field
}
```
This of course works (and was likely optimized out by the compiler), but bloats
generated code for no benefit.
This change merely makes the second case generate:
```rust
{
let field = registry.field::<String>("id", &());
field
}
```
Fixes https://github.com/graphql-rust/juniper/issues/185.
* use prebuilt cargo-make for travis build
* use prebuilt cargo-make for travis build
* use prebuilt cargo-make for travis build
* use prebuilt cargo-make for travis build
* use prebuilt cargo-make for travis build
The conversions in this changeset cannot use the `From<T>` trait
implementation because the conversion is lossy, either because they
involve converting a signed value to an unsigned value (`i32`⇒`u64`)
or because the convert from a larger data type to a smaller one
(`u64`⇒`i32`). In this case, the `as` type cast is necessary to perform
a bitwise conversion.
This coercion can cause negative values to become very large unsigned
values. This is intentional on line 90.
It doesn't appear that `:tt` accepts the `stringify!()`-ed value in this
position. The :tt is only later used as an `:expr` to produce the name
for metadata purposes.
Converting this position to be an `:expr` allows the `stringify!()`-ed
value and accepts all current uses of the `graphql_scalar!()` macro in
this repository.
Fix chrono DateTime support
The DateTime support was improperly implemented with time (hour + minute support), which is fixed by this commit.
Documentation and tests have also been updated.
Only author: @sporto