Commit graph

693 commits

Author SHA1 Message Date
iancormac84
001cabc9e9 Changes. 2020-01-18 17:14:35 -08:00
iancormac84
c6ac0bdcef Add changes from async-await branch to Changelog. 2020-01-18 17:14:35 -08:00
Christian Legnitto
fc7827605c Release juniper_warp 0.5.2 2020-01-18 17:14:35 -08:00
Christian Legnitto
0542c3aeac Release juniper_rocket 0.5.2 2020-01-18 17:14:35 -08:00
Christian Legnitto
37d2b195bc Release juniper_iron 0.6.2 2020-01-18 17:14:35 -08:00
Christian Legnitto
9d3cfc1c59 Release juniper_hyper 0.5.2 2020-01-18 17:14:35 -08:00
Christian Legnitto
73dc5cd5b8 Release juniper 0.14.2 2020-01-18 17:14:35 -08:00
Christian Legnitto
a5ccf8c2a1 Release juniper_codegen 0.14.2 2020-01-18 17:14:35 -08:00
Christian Legnitto
3c41769cb7 Update quickstart on every release (#485) 2020-01-18 17:14:35 -08:00
Massimo Cairo
9fe1c29889 Validate variables of the executed operation only (#462)
* Validate variables of the executed operation only

* Use `unreachable!` in `validate_var_defs`.

Use `unreachable!` instead of `panic!` on invalid variable types,
since thay have already been checked during document validation.

* Fix formatting in `validation/input_value.rs`
2020-01-18 17:14:35 -08:00
Alexander Simmerl
16967d7d98 Add example of how to construct null in graphql_value 2020-01-18 17:14:35 -08:00
Samuel Hurel
5b1c5c697a Add note on complex fields impl block in doc (#483) 2020-01-18 17:14:35 -08:00
Massimo Cairo
d4c75f0ba5 Fix unused variable error message
Was copied from undefined variable error message.
2020-01-18 17:14:35 -08:00
Jens Krause
14986ff419 Use latest graphiql (v0.17.2) (#477)
incl. upgrade to latest React
2020-01-18 17:14:35 -08:00
Jens Krause
c342ecf73a Use latest graphql-playground (#476) 2020-01-18 17:14:35 -08:00
James Harton
bc9183784f Loosen constraints on uuid version.
The `uuid` maintainers have started releasing in the `0.8` version train.  I've relaxed the version requirements on `juniper`'s dependencies to allow juniper users to specify a different version in their `Cargo.toml` and still have the integration work.
2020-01-18 17:14:35 -08:00
Klaus Purer
4a91d9d205 docs(quickstart): Fix juniper version so the examples work 2020-01-18 17:14:35 -08:00
Graeme Coupar
c2f0dd2aec Implement GraphQLTypeAsync for Arc (#479)
* Implement GraphQLTypeAsync for Arc

I'm building a GraphQL API using Juniper that proxies another GraphQL
API.  It does a large fetch upfront from the underlying GraphQL API,
transforms it into a different format and then implements some
resolvers that do some further filtering.

One of these resolvers ends up looking like:

```
async fn items(&self, ...) -> Vec<Item> {
    self.items.iter().filter(...).collect()
}
```

This causes us problems as we're returning owned Item's and Item is a
large nested structure that would be expensive to clone.

Our current work around was to put Item into an Arc, as Arc is
comparatively cheap to clone.  So our method becomes:

```
async fn items(&self, ...) -> Vec<Arc<Item>> {
    self.items.iter().filter(...).map(Arc::clone).collect()
}
```

However to support this we needed Arc to implement GraphQLTypeAsync.
This commit adds that support to juniper, by forwarding to the
GraphQLTypeAsync implementation for the contained type.

It's possible that we could have acheived something similar by adding
some lifetimes to our resolver and returning a reference, but using an
Arc was easier for us in this case.  I'm not sure if there's any reason
why this would be a bad addition to Juniper overall?

* Move GraphQLTypeAsync for Arc<T> into pointers.rs
2019-12-22 14:54:03 -08:00
danieleades
6fa6c20fa7 address clippy::all lints (#486) 2019-12-17 20:37:46 -08:00
Christoph Herzog
f0ba1c07da ci: Fix used rust version 2019-11-16 03:39:36 +01:00
Christoph Herzog
ce3cf45ca9 Rename object proc macro to graphql_object 2019-11-16 02:57:48 +01:00
Christoph Herzog
a31d3f3888 Remove old graphql_object! macro 2019-11-16 02:33:20 +01:00
Christoph Herzog
358071bfa4 Remove deprecated ScalarValue derive
This was renamed to GraphQLScalarValue and has been deprecated for a
while
2019-11-16 02:33:20 +01:00
Christoph Herzog
46590ae884 book: Fix union and scalar code examples 2019-11-16 02:33:20 +01:00
Christoph Herzog
9ce3d04007 Improve union proc macro
* Rename to graphql_union
* Implement full-featured parsing and code generation
2019-11-16 02:33:18 +01:00
Christoph Herzog
6861951a1e Disable async tests for juniper 2019-11-15 22:36:25 +01:00
Christoph Herzog
27e5e447c7 Fix pattern move error on stable 2019-11-15 22:34:08 +01:00
Christoph Herzog
641e87a0b6 Add back documentation for graphql_scalar! macro 2019-11-15 22:18:39 +01:00
Christoph Herzog
4f287806bd Update CHANGELOG with master breaking changes 2019-11-15 22:18:39 +01:00
Christoph Herzog
5d270b7dea Formatting 2019-11-15 22:18:38 +01:00
Christoph Herzog
50605ee73e Duplicate juniper_rocket for async
This is required because rocket only supports futures on a git branch.
2019-11-15 21:52:22 +01:00
Christoph Herzog
38c3e28f22 Disable async tests on CI 2019-11-15 21:44:24 +01:00
Christoph Herzog
f6c0bc7b02 Fix tests. 2019-11-15 21:44:08 +01:00
Christoph Herzog
b634ad39eb Various async feature fixes for the type system 2019-11-15 21:23:59 +01:00
Christoph Herzog
ad16093b88 Refactor GraphQLType::resolve to return Result<>
This unifies the output type of all resolvers.

Required for future step of making the output a associated type.
2019-11-14 09:51:32 +01:00
Christoph Herzog
6fcdd32c84 Remove GraphQLType ScalarValue default
This is more hinderance than useful.
2019-11-14 01:31:14 +01:00
Christoph Herzog
36c71d7162 chore: Remove ScalarRefValue trait
The trait was introduced while introducing generic scalars, but is not
actually required or useful. It's functionality is fully covered by
methods on the `ScalarValue` trait.

It also forced a lof of for<'a> ScalarRefValue bounds all over the code,
complicating signatures a lot.

It is completely removed now.
2019-11-14 01:21:41 +01:00
nWacky
eb85fefc36 Get back panic in macro [skip ci] 2019-11-13 14:26:25 +00:00
nWacky
2144ad0d7d Remove async-trait [skip ci] 2019-11-13 14:26:25 +00:00
nWacky
a5580a939d Update most crates to futures 0.3, add todos on not updated crates 2019-11-12 12:04:09 +00:00
nWacky
cf99495368 Replace all futures::BoxFuture with juniper::BoxFuture 2019-11-12 12:04:09 +00:00
nWacky
237e69c036 Rebase async_await onto master (#454)
* feat: Raw identifier support in object macro

This commit implements raw identifier (`r#name`) support
for field names (methods) and arguments in the `object` proc macro.

Eg:

```rust
impl T {
  fn r#type(r#trait: String) -> bool {}
}
```

* Rebase onto master

* Fix merge [skip ci]
2019-11-08 09:46:48 +00:00
Christian Legnitto
b133a0f3c2
Merge pull request #452 from instrumentisto/async-await-resolve-some-todos
Resolve some todos in async-await branch
2019-11-06 18:17:50 -08:00
nWacky
778606c050
Fix bad merge [skip ci] 2019-11-06 12:01:50 +03:00
nWacky
e344f1c06f
Merge branch 'async-await-resolve-some-todos' of https://github.com/instrumentisto/juniper into async-await-resolve-some-todos
# Conflicts:
#	juniper/src/macros/tests/args.rs
[skip ci]
2019-11-06 11:46:21 +03:00
nWacky
09d9513da9
Rebase onto master 2019-11-06 11:45:19 +03:00
nWacky
4834349310
Rebase onto async-await 2019-11-06 11:21:06 +03:00
nWacky
e151026cfa
Merge branch 'async-await-resolve-some-todos' of https://github.com/instrumentisto/juniper into async-await-resolve-some-todos
# Conflicts:
#	examples/warp_async/Cargo.toml
#	juniper/src/macros/tests/args.rs
#	juniper_codegen/src/util.rs
[skip ci]
2019-11-05 12:10:04 +03:00
nWacky
99c0d26887
Comment out attr_arg_descr and attr_arg_descr_collapse tests 2019-11-05 12:06:08 +03:00
nWacky
ec76bf5ff2
Fix cargo.toml in warp_async 2019-11-05 11:20:08 +03:00