Commit graph

61 commits

Author SHA1 Message Date
Kai Ren
72ed45a77c
Rework CI and project toolchain (#1043)
- remove `cargo-make` integration
- rework CI pipeline more granular and precise
- rework releasing process
- tune up project layout
- fill up new CHANGELOGs

Additionally:
- fix latest nightly/stable Rust inconsistencies
2022-04-08 17:44:50 +03:00
Christian Legnitto
93deb2862a
Make juniper_rocket_async replace juniper_rocket (#955)
* Make juniper_rocket_async replace juniper_rocket

Now that rocket v0.5 is async and in rc, merge the two juniper projects.

Fixes https://github.com/graphql-rust/juniper/issues/947.

* Remove println
2021-07-07 09:26:22 -07:00
Mihai Dinculescu
8d7ba8295c
Impl subscriptions for juniper_actix (#716)
* Impl subscriptions for juniper_actix

* Add random_human example subscription

* Add actix_subscriptions example to CI

* fixup! Add random_human example subscription

* Migrate actix subscriptions to juniper_graphql_ws

* Simplify error handling

* Change unwrap to expect

* Close connection on server serialization error

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-08-09 12:19:34 -10:00
Chris
84c9720b53
GraphQL-WS crate and Warp subscriptions update (#721)
* update pre-existing juniper_warp::subscriptions

* initial draft

* finish up, update example

* polish + timing test

* fix pre-existing bug

* rebase updates

* address comments

* add release.toml

* makefile and initial changelog

* add new Cargo.toml to juniper/release.toml
2020-07-28 22:23:44 -10:00
Christian Legnitto
4647a32b33
Add examples to CI (#714) 2020-07-20 21:38:22 -10:00
Mihai Dinculescu
d13305f202
Exclude basic subscriptions example from workspace (#648) 2020-05-02 15:31:32 -10:00
Jonas Meurer
558eae91df
Ensure Specification(June 2018) Compliance (#631)
* Implemented most test cases from the specification

* Unified error handling for all generators

- Removed proc-macro-error -> not required -> use syn::Error
- Everything below lib.rs uses proc_macro2::TokenStream
  instead of proc_macro::TokenStream
- Replaced error handling in attribute parsers

* WIP better error messages for *all* macros

* Refactored GraphQLInputObject and minor tweaks

- removed support for Scalar within a string ("DefaultScalarValue")
- removed unraw function and replaced it with the built-in one
- added error messages and return types for all functions within utils
- added more constraints to fulfill the GraphQL spec

* Fixed test-cases which are not compliant with the specification

* Removed unused function

* Added constrains, updated error messages, added marker

* Added argument rename within impl_graphql and fixed `__` tests

* Formatted and cleanup

* Added GraphQLTypeAsync for input object

* Moved codegen tests to separate module

Nightly and stable produce different outputs, thus only test nightly.

* Added IsInputType/IsOutputType traits for type checking

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-05-01 16:24:01 -10:00
Jordão Rodrigues Oliveira Rosario
a47d1c5430
Add actix-web integration (#603) 2020-04-20 20:21:02 -10:00
Christian Legnitto
c09be69b7d
Update rocket_async to central GraphQLBatch* enums (#612) 2020-04-09 22:10:24 -10:00
nWacky
eb941e509a
Add subscription support (#433)
Co-authored-by: tyranron <tyranron@gmail.com>
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-03-18 20:31:36 -07:00
Christian Legnitto
a54a6e9621 Turn off juniper_warp until it is fixed 2020-01-21 09:04:27 -08: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
acd1442cea Experimental benchmarks 2019-08-21 15:48:31 +02:00
Christoph Herzog
746bdb5aae Add warp_async example 2019-08-21 15:48:31 +02:00
Christoph Herzog
a14f0ddebd WIP async/await implementation 2019-08-21 15:48:31 +02:00
Christoph Herzog
51bde5d94f Remove old 2018 edition compatability tests.
Those are not needed anymore since the refactor to 2018 edition.
2019-05-02 20:18:21 +02:00
Christoph Herzog
9623e4d326 (book) Update and fix book compilation and tests
* Use mdbook for building the book
* Update book config
* Update book hierarchy to work properly with mdbook
    This necessitated adding place-holder index pages
    since mdbook does not suppoert stand-alon menu items
* Update tests to use 2018 edition
* Fix various compilation errors in the tests
2019-03-08 11:47:13 +01:00
Christoph Herzog
f02e427cab Refactor integration test layout + add minimal 2018 edition test
* Add a new integration_tests subdirectory that holds integration tests
* Add a new, temporary (and really minimal) 2018 edition test crate
2018-12-19 03:53:33 +01:00
Christian Legnitto
4c92b45e57 Change the order of crates in the workspace
This is needed when we use `carg-make` for releases. From
https://github.com/sagiegurari/cargo-make#usage-workspace-support:

"The order of the members is defined by the member attribute in the workspace Cargo.toml."
2018-12-12 19:20:23 -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
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
Damir Vandic
44002f0884 Hyper integration crate (#230)
This adds the new integration crate `juniper_hyper`.
2018-09-01 20:02:01 -07: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
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
Stanko Krtalić
2f62bc55e1 Split out rocket_integration into separate crate
This split still requires some work as the tests currently fail. This is
caused by the fact that some previously private modules can't be
accessed anymore, and that Rocket changet it's testing framework.
2017-08-06 13:41:55 +02:00
theduke
35ea952961 Added new crates to workspace manifest. 2017-07-12 21:51:24 +02:00
theduke
4ab2f20b8f Restructure repository to Cargo workspace.
This makes it possible to:
* extract parser to own crate
* add juniper_codegen crate for custom derive stuff
* add integration tests
2017-07-12 21:51:24 +02:00
Magnus Hallin
9ca173f6bf Add CI badges 2017-06-19 09:47:02 +02:00
Magnus Hallin
39159acb41 Fix broken crate metadata, prepare 0.8.1 release 2017-06-15 22:11:27 +02:00
Magnus Hallin
6aed455f03 Prepare for 0.8.0 release 2017-06-15 16:53:27 +02:00
Magnus Hallin
e82534aced Initial work on Rocket integration 2017-06-14 15:50:27 +02:00
Magnus Hallin
47659c6006 Rely on docs.rs for documentation rather than hosting our own 2017-06-14 09:20:05 +02:00
Magnus Hallin
41a33a3238 Merge branch 'serde-1.0' of https://github.com/zaeleus/juniper into zaeleus-serde-1.0
# Conflicts:
#	Cargo.toml
2017-06-14 09:05:56 +02:00
Magnus Hallin
7d7e7e6252 Don't depend on serde_json by default, rename some structs 2017-06-14 09:02:56 +02:00
Magnus Hallin
7041efeda9 Merge branch 'drop_rustc_serialization' of https://github.com/TheServerAsterisk/juniper into TheServerAsterisk-drop_rustc_serialization
# Conflicts:
#	examples/server.rs
2017-06-14 08:51:49 +02:00
Michael Macias
0f5182460f Upgrade to serde 1.0
serde 1.0.0 introduces breaking changes. See the release notes for more
details: <https://github.com/serde-rs/serde/releases/tag/v1.0.0>.

Fixes #50
2017-05-26 16:15:03 -05:00
Magnus Hallin
95b4124f6b Provide better error message when running example without features
Even better would be if "cargo run --example server" would
automatically enable those features, but Cargo can't do that right now.
2017-05-18 10:31:53 +02:00
rpiper
6c4b329848 Added serde_derive and urlencoded as dependecies. 2017-05-14 19:30:49 -06:00
rpiper
41112d0b6d Drop support for rustc-serialization and use serde by default. 2017-04-30 20:07:36 -06:00
Magnus Hallin
eca20cd8ca Prepare for 0.7.0 release 2017-02-26 12:58:52 +01:00
Magnus Hallin
3035eb84cf Merge pull request #30 from zaeleus/iron-0.5
Update to iron 0.5
2017-02-26 09:21:36 +01:00
Magnus Hallin
9d520d77f9 Prepare for 0.6.3 release 2017-02-19 12:53:00 +01:00
Michael Macias
b2e75bf4f6 Update to iron 0.5
* `Url::into_generic_url` was deprecated in 0.4.1. The `Into` trait is
    used instead.
  * iron/logger removed support for ANSI terminal colors in 0.2.0, which
    makes logging work in the Command Prompt on Windows.

Fixes #21
2017-02-16 02:08:26 -06:00
Magnus Hallin
987aa40da1 Prepare for 0.6.2 release 2017-02-04 16:55:58 +01:00
Magnus Hallin
3fe3c76106 Add package to web programming category 2017-02-04 11:36:39 +01:00
Michael Macias
a834115d87 Update to serde 0.9
serde 0.9.0 introduces breaking changes. See the release notes for more
details: <https://github.com/serde-rs/serde/releases/tag/v0.9.0>.
2017-01-26 17:25:17 -06:00
Michael Macias
b78aef715d Make rustc-serialize optional
This extracts rustc-serialize JSON serialization into its own module,
decoupling all core structures from its use.

rustc-serialize can now be completely disabled, removing it as a
dependency if serde (or none) is used instead. It is, however, still the
default serializer. In Cargo, the `default-features` field must be set
to `false` to disable it, e.g.,

    [dependencies.juniper]
    version = "0.6"
    default-features = false
    features = ["serde"]

The Iron handlers still require rustc-serialize.

The default values for attributes changed from being formatted as JSON
to how it is defined in [the reference implementation][printer.js].

[printer.js]: https://github.com/graphql/graphql-js/blob/v0.8.2/src/language/printer.js
2017-01-06 21:34:44 -06:00
Magnus Hallin
8620eb1e7a Prepare for 0.6.1 release 2017-01-06 13:15:16 +01:00