Commit graph

44 commits

Author SHA1 Message Date
Christoph Herzog
835dee1a8e Enable merge_imports rustfmt setting.
style: Enable rustfmt merge_imports and format

This commit enables the rustfmt merge_imports setting
and formats the whole code base accordingly.

Note that the setting is not stable yet, but will be with Rust 1.38.

In the meantime, running fmt on stable will just leave the
changes alone so no problems should occur.
2019-08-21 15:42:16 +02:00
Christian Legnitto
e8da141925 Release juniper_iron 0.5.1 2019-07-29 08:10:37 -07:00
Christian Legnitto
48c26a26b3 Release juniper 0.13.1 2019-07-29 08:08:05 -07:00
Christian Legnitto
8fc1808f14 Release juniper_iron 0.5.0 2019-07-19 14:01:21 -07:00
Christian Legnitto
54f98f46db Release juniper 0.13.0 2019-07-19 14:01:21 -07:00
Peter Majchrak
3373935046 Add support for "dyn" trait object syntax (#385)
* Use "dyn" for TraitObjects

* Cleanup after adding "dyn" support

* Add entry to CHANGELOG.md
2019-06-27 08:44:30 -07:00
Andrey Kutejko
5b9a0bd31b Split Query and Database types in example schema (#360) 2019-05-18 09:07:51 -07:00
Christian Legnitto
bd2da308e3 Release juniper_iron 0.4.0 2019-05-16 19:09:12 -07:00
Christian Legnitto
9c9e3da72d Release juniper 0.12.0 2019-05-16 19:03:21 -07:00
Christoph Herzog
166c6d00c5 (tooling) Update release config to bump doc_root. 2019-05-15 11:20:51 +02:00
Yusuke Sasaki
0ae2475bb8 add #[doc(html_root_url)] to all published crates 2019-05-15 11:20:51 +02:00
Christoph Herzog
29025e6cae
Rename impl_object to object. 2019-05-13 21:15:14 +02:00
Christoph Herzog
1b30e012ae
(iron) impl_object refactor 2019-05-12 10:36:30 +02:00
Christian Legnitto
794568e463
Add release automation (#346)
See `RELEASING.md` for directions
2019-05-11 23:51:28 -07:00
Christoph Herzog
5a4230e0d0
Remove macro_use + extern crate statements (2018 edition) 2019-05-02 18:44:56 +02:00
Christoph Herzog
54a1b64a79
Refactor code to 2018 edition with 'cargo fix --edition' 2019-05-02 18:44:56 +02:00
Jakob Gillich
b4a0669b37 Add GraphQL Playground integration (#317) 2019-01-25 20:58:01 -08:00
theduke
d015a3ca66 (ci) Check formatting with cargo fmt (#302)
This adds a new extra CI job for checking the formatting
with cargo fmt --check.
2018-12-19 10:27:49 -08:00
Christian Legnitto
9459435670 Update changelogs
Not sure why `cargo release` didn't do this...
2018-12-17 15:06:16 -08:00
Christian Legnitto
1868acc5a1 Bump versions past current crates.io version 2018-12-17 14:04:40 -08:00
Christian Legnitto
73175d7a10 Bump version 2018-12-17 13:11:21 -08: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
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
f2f68f868a
Add failure cases to http integration tests (#239) 2018-09-02 10:59:54 -07:00
Damir Vandic
273edc1d64 Add charset meta to GraphiQL iron integration (#228)
Fixes #223
2018-08-20 10:19:47 -07:00
Christoph Herzog
56f71e934b Format code 2018-07-19 16:18:49 +02:00
Christian Legnitto
915b846a83
Update CHANGELOG.md 2018-07-13 01:31:13 -07:00
Andrey Kutejko
e63b42bc8e (juniper_iron) fallible context factory (#180) 2018-07-13 01:30:14 -07:00
Christian Legnitto
521930e911
Escape urls in iron integration tests (#208)
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
2018-07-12 18:34:37 -07:00
Cameron Eldridge
e84167286b Handle an array of GraphQL queries (#171) 2018-06-07 17:44:30 -07:00
Atul Bhosale
875c80748d Fix cargo clippy warnings 2018-05-03 07:27:15 +02:00
Christian Legnitto
28763a5639 Fix warning in iron_juniper
The warning was:

```
warning: unnecessary parentheses around function argument
   --> juniper_iron/src/lib.rs:268:43
    |
268 |             _ => return Ok(Response::with((status::MethodNotAllowed))),
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
    |
    = note: #[warn(unused_parens)] on by default
```
2018-02-21 15:07:37 +01:00
Christoph Herzog
47575ef922 Prepare juniper_iron 0.1.2 release 2018-02-10 13:59:04 +01:00
Matrix
d9677b38df (iron) Update to iron 0.6
* Allow both iron 0.5 and 0.6
* Allow both urlencoded 0.5 and 0.6
2018-02-08 22:56:19 +01:00
Christoph Herzog
d00e74bb4e Format entire codebase with rustfmt 2018-01-13 12:25:55 +01:00
Christoph Herzog
40c946c81c 0.9.2 release
* Changelogs
* Update versions and dependency versions
2018-01-13 10:34:30 +01:00
theduke
ca9d5c1c1a Bump to 0.9.1 and fix up Cargo.toml files 2017-12-03 18:48:38 +01:00
theduke
ed58f2671b Final readme and cargo.toml fixups 2017-12-03 15:14:23 +01:00
theduke
e37b7cc77d Fix repository links in iron/rocket Cargo.toml 2017-12-03 13:12:45 +01:00
theduke
4d6a99fe4e Fix up Cargo.toml files and documentation. 2017-12-02 18:33:20 +01:00
theduke
bec5295827 Move juniper_iron crate back into the main repo.
This is done for a lower maintainance burden and combined testing.
2017-12-02 15:56:52 +01:00
theduke
2ca9baa441 Extracted iron/rocket crates and updated README.
Those now live in separate repos.
2017-08-07 08:20:05 +02:00
theduke
0c7e39f14e Rust fmt the whole codebase 2017-08-06 21:15:08 +02:00
theduke
619a2e57f9 Extraction of iron and rocket features into separate crates.
* Added juniper_iron crate
* Fixed up juniper_rocket crate
* Updated juniper/Cargo.toml
* Updated docs (readme, module docs)
* Export http integrator tests with export-test-schema feature
* Update CI tests (Use cargo-make )
* Format parts of the code base
2017-08-06 17:42:31 +02:00