Commit graph

392 commits

Author SHA1 Message Date
Eric Dattore
cb00a7b2bc Update juniper_rocket for Rocket 0.4 (#277)
Path handling changed in Rocket 0.4 and this commit updates the way
those paths are handled. It adds an implementation of the
`FromFormValue` trait to the `GraphQLRequest` object. It also changes
the documentation to use the multi-segment query string syntax.

All existing tests pass as expected.
2018-12-10 17:45:22 -07:00
Christian Legnitto
3ce3b21eb1
Flatten juniper_warp example (#289)
This isn't needed, as examples by default are built when the
containing crate is tested.

I also confirmed that `cargo run --example warp_server` still works.
2018-12-08 20:27:23 -07:00
Christian Legnitto
78d5ab795b
Make travis builds not cache (#290)
See https://levans.fr/rust_travis_cache.html. I suspect it is causing
failures like https://travis-ci.org/graphql-rust/juniper/jobs/465442258 as
well.
2018-12-08 20:26:51 -07:00
Will Glynn
4858f90a70 Build wasm32-unknown-unknown in CI (#278)
* Build wasm32-unknown-unknown in CI (#218)

`cargo check --wasm32-unknown-unknown` is sufficient to demonstrate that the
`juniper` and `juniper_codegen` crates can compile for WebAssembly, which should
help avoid accidental regressions.
2018-12-07 12:46:22 -07:00
Christian Legnitto
e6923defb1
Fix CI (#288) 2018-12-07 11:57:17 -07:00
Christian Legnitto
7bb62ff259
Make rust 1.28 minimum supported version (#285) 2018-12-03 17:28:49 -08:00
Christian Legnitto
fe2bf611bb
Use pre-compiled cargo-make (#281) 2018-12-03 16:24:41 -08:00
Brendan Ball
e2212a539a Add method to scalar (#283) 2018-11-29 09:47:19 -08:00
Georg Semmler
4ecf558066 Use doc comments instead of the doc attribute in the changelog examples (#273) 2018-11-11 14:58:50 -08:00
Kevin Stenerson
0f2a654471 Infer graphql "deprecation" from #[deprecated(note = "...")] in derive (and macros) (#269)
* Update object/iface macro with doc/deprecated attrs for fields

* Use the note from `#[deprecated]` by default in derived GraphQLType

* Update to support multiline raw-docstring format

* Support bare deprecated attribute

* Update arguments to support #[doc] for parity with previous ` as ` syntax
2018-10-27 21:28:48 -06:00
Christian Legnitto
f61fdb2063
Add previous juniper_warp changes to the changelog
Fixes https://github.com/graphql-rust/juniper/issues/268
2018-10-27 19:00:32 -07:00
Christian Legnitto
86fdd25ac7
Upgrade juniper_warp to warp 0.1.8 (#271)
This unbreaks the build, as the newer warp deprecates some of the filters we
were using and we had `deny_warnings` on.
2018-10-27 19:45:47 -06:00
Cole Graber-Mitchell
cf7e8df65f Make operation_name public (#265)
Fixes #253.
2018-10-23 06:09:39 -06:00
Tom Houlé
edecb8c99f Get rid of futures_cpupool in juniper_warp (fixes #258) 2018-10-23 06:01:06 -06:00
Christian Legnitto
3266c237e9 Fix build 2018-10-23 05:45:12 -06:00
Tom Houlé
95dc436bb3 Rename graphiql_handler to graphiql_filter in juniper_warp (#267)
This is a more idiomatic name for warp, and it _is_ a filter.
2018-10-22 22:05:01 -06:00
Georg Semmler
2e5df9f8a4 Introduce an abstraction for scalar values (#251)
Introduce an abstraction for scalar values

Before this change,  possible scalar values were hard coded to be representable
by one of the following types: `i32`, `f64`, `String` or `bool`. This
restricts the types of custom scalar values that can be defined. For
example, it was not possible to define a scalar value that represents an
`i64` without mapping it to a string (which would be inefficient).

One solution to fix the example above would simply be to change the
internal representation to allow it to represent an `i64`, but this would
only fix the problem for one type (until someone wants to support
`i128` for example). Also this would make juniper not follow the
GraphQL standard closely.

This commit takes another approach, by making the exact "internal"
representation of scalar values swappable (in such a way that a downstream crate could provide its own representation tailored to their needs). This allows juniper to provide a default type that only
contains the types described in the standard whereas other crates could define custom scalars for their needs.

To accomplish this we need to change several things in the current implementation:

* Add some traits that abstract the behavior of such a scalar value representation
* Change `Value` and `InputValue` to have a scalar variant (with a
  generic type) instead of hard coded variants for the standard
  types. This implies adding a generic parameter to both enums that
  needs to be added in the whole crate.
* Change the parser to allow deciding between different types of
  scalar values. The problem is basically that the original parser
  implementation had no way to know whether a parsed integer number is
  a `i32` or a `i64` (for example). To fix this we added some knowledge
  of the existing schema to the parser.
* Fix some macros and derives to follow the new behavior.

This commit also contains an unrelated change about the way `juniper_codegen`
resolves items from `juniper`. The `_internal` flag is removed and
the resolution is replaced by a macro.

The scalar parsing strategy is as follows:

* Pass optional type information all the way down in the parser. If a
  field/type/… does note exist, just do not pass down the type
  information.
* The lexer now distinguishes between several fundamental scalar types (`String`, `Float`, `Int`). It does not try to actually parse those values, instead it just annotates them that this is a floating point number, an integer number, or a string value, etc.
* If type information exists while parsing a scalar value, try the following:
    1. Try parsing the value using that type information.
    2. If that fails try parsing the value using the inferred type information from the lexer.
* If no type information exists, try parsing the scalar value using the inferred type from the lexer,

All macros support the introduced scalar value abstraction. It is now possible to specify if a certain implementation should be based on a specific scalar value representation or be generic about the exact representation. All macros now default to the `DefaultScalarValue` type provided by
`juniper` if no scalar value representation is specified. This is done with usability and backwards compatibility in mind.

Finally, we allow specifying the scalar value representations via an attribute
(`#[graphql(scalar = "Type")]`). A default generic implementation
is provided.
2018-10-22 21:40:14 -06:00
Christian Legnitto
bd455c9130
Remove Appveyor (#264)
Now that we have azure pipelines set up, there is no need
to use appveyor.

Part of https://github.com/graphql-rust/juniper/issues/259
2018-10-08 21:15:09 -07:00
Christian Legnitto
592060d3f2
Set up CI with Azure Pipelines (#263) 2018-10-08 14:45:49 -07:00
Dylan DPC
95efe3821c Update uuid to 0.7 (#262) 2018-10-07 11:11:06 -07:00
Christian Legnitto
e8a83ac816
Update Makefile.toml 2018-10-02 22:24:54 -07:00
Christian Legnitto
61ea25f61b
Use latest cargo make (#260) 2018-10-02 14:53:09 -07:00
Christian Legnitto
64da0bdbe5
FIx link to juniper_warp docs 2018-09-30 11:19:33 -07:00
Christian Legnitto
f3940df6d5
Add changelog entry for https://github.com/graphql-rust/juniper/pull/256 2018-09-30 11:18:21 -07:00
Jon Gjengset
ec963a6e71 Use only a single thread pool for juniper_hyper (#256)
The previous implementation used a futures_cpupool for executing
blocking juniper operations. This pool comes in addition to the
thread pool started by hyper through tokio for executing hyper's futures.
This patch uses tokio::blocking to perform the blocking juniper
operations while re-using the same thread pool as hyper, which
simplifies the API.
2018-09-30 11:07:44 -07:00
Christian Legnitto
50a9fa31b6
Add links to the book for 0.10.0 features 2018-09-13 23:33:25 -07:00
Damir Vandic
347777a8d0 Use raw url for Juniper logo in README 2018-09-13 21:06:20 +02:00
Christian Legnitto
0531bf7790
Fix README grammar 2018-09-13 11:10:02 -07:00
Christian Legnitto
be4c352939
Use the crates.io version of reqwest (#247)
This allows us to publish `juniper_hyper`
2018-09-13 10:06:03 -07:00
Christian Legnitto
e82abede94
Fix up licenses for warp and hyper integrations (#246) 2018-09-13 09:32:21 -07:00
Christian Legnitto
9c1ce1fb7a
0.10.0 release (#236)
* Bump` juniper`, `juniper_codegen`, and `juniper_tests` versions.

* Bump integration crate requirements to include 0.10.0. `juniper_iron` gets a semver breaking version as it has a breaking change but `juniper_iron` does not.

* Move `juniper_rocket` changelog into one file. This aligns with `juniper_iron` and will be easier
to automate in the future.

* Let `juniper_warp` and `juniper_hyper` use `0.9.x` versions of Juniper. They don't rely on anything in 0.10.0 so don't require it.
2018-09-13 09:13:31 -07:00
Christian Legnitto
842b2e36fe
Update README text to include warp 2018-09-07 15:42:06 -07:00
Tom Houlé
fd636e07df Add integration crate for the warp framework (#216) 2018-09-07 14:28:56 -07:00
Christian Legnitto
1ee3dab3b7
Handle InputValues that return None (#244)
Fixes https://github.com/graphql-rust/juniper/issues/242.
2018-09-07 08:27:33 -07:00
Christian Legnitto
9bee530bcd
Pretty print debugging info (#243) 2018-09-05 22:47:12 -07:00
Damir Vandic
cc9aa6e011 Fix hyper examples link in README (#241) 2018-09-05 10:51:09 -07:00
Christian Legnitto
f2f68f868a
Add failure cases to http integration tests (#239) 2018-09-02 10:59:54 -07:00
Damir Vandic
fc10b5e8f5 Update readme with link to hyper and fix link to example server (#240) 2018-09-02 10:29:47 -07:00
Damir Vandic
44002f0884 Hyper integration crate (#230)
This adds the new integration crate `juniper_hyper`.
2018-09-01 20:02:01 -07:00
Marshall Bowers
facb0d2f5d [juniper_rocket] Expose GraphQLResponse fields (#238) 2018-08-31 18:46:27 -07:00
Christian Legnitto
45004f77a3
Allow crate type paths in resolve for graphql_scalar! (#229)
Fixes https://github.com/graphql-rust/juniper/issues/227.
2018-08-27 15:26:33 -07:00
Christian Legnitto
08c31357af
Add support for lifetime annotations when using derives (#226)
Fixes https://github.com/graphql-rust/juniper/issues/225
2018-08-27 15:25:15 -07:00
Christian Legnitto
22c955599a
Add support for skipping fields in GraphQL objects (#224)
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.
2018-08-27 15:09:42 -07:00
Dirkjan Ochtman
62d015cf86 Upgrade juniper_codegen dependencies (#231)
* Upgrade `juniper_codegen` to `syn-0.14`/`quote-0.6`

* Upgrade `juniper_codegen` to `regex-1.0`

* Fix comment typos in enum derive code

* Stop testing rust-1.21.0, replace with rust-1.23.0. rust-1.21.0 breaks with the newer dependencies
2018-08-27 14:51:12 -07:00
Yusuke Sasaki
d496220e10 Use local_inner_macros to all helper macros (#233)
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
2018-08-26 12:11:27 -07:00
Damir Vandic
273edc1d64 Add charset meta to GraphiQL iron integration (#228)
Fixes #223
2018-08-20 10:19:47 -07:00
Christian Legnitto
c04b06f79b
Fix bad merge (#222) 2018-08-19 08:10:18 -06:00
Damir Vandic
ec59766d51 Use 'extensions' as field for error details (#219) 2018-08-13 07:53:52 -06:00
Georg Semmler
90b89f00ee Performance improvements (#202)
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
2018-08-13 07:47:18 -06:00
Christoph Herzog
56f71e934b Format code 2018-07-19 16:18:49 +02:00