Commit graph

79 commits

Author SHA1 Message Date
Christoph Herzog
a14f0ddebd WIP async/await implementation 2019-08-21 15:48:31 +02:00
theduke
a3caf126b0 derive: Upgrade syn/quote/proc_macro dependencies to 1.0 (#413) 2019-08-18 09:12:25 -07:00
Christian Legnitto
48c26a26b3 Release juniper 0.13.1 2019-07-29 08:08:05 -07:00
Christian Legnitto
6b32e90899 Release juniper_codegen 0.13.2 2019-07-29 08:07:32 -07:00
Christian Legnitto
644d6042ae Release juniper_codegen 0.13.1 2019-07-29 08:06:22 -07:00
Christoph Herzog
049ba0c9dc (codegen) Respect mut modifier on arguments in object proc macro
This commit forwards `mut` declaration of arguments in a #[juniper::object] macro invocation
to the generated code.

Closes #399
2019-07-24 02:37:31 +02:00
Christian Legnitto
54f98f46db Release juniper 0.13.0 2019-07-19 14:01:21 -07:00
Christian Legnitto
efe22b7ffd Release juniper_codegen 0.13.0 2019-07-19 14:01:21 -07:00
Christian Legnitto
7bedea05ed
Clean up test warnings (#392) 2019-07-15 21:47:16 -07:00
Peter Majchrak
28ca8fe006 Cleanup after #385 (#386) 2019-06-27 15:32:36 -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
Christoph Herzog
97e1005178 Clean up ScalarValue transparent derive argument handling and documentation. 2019-06-25 18:55:45 +02:00
theduke
7e0e7beaa7 Allow scalars without #[repr(transparent)] 2019-06-25 18:55:45 +02:00
Christoph Herzog
3396074274 (codegen) Implement newtype derive for scalars.
This commit implements a newtype style custom derive
for scalars via `#[derive(GraphQLScalarValue)]`, which now
supports both deriving a base enum scalar type and newtypes.

For newtypes, the `#[graphql(transparent)]` attribute is
required.

This commit:
* implements the derive
* adds integration tests
* updates the book
2019-06-25 18:55:45 +02:00
Kai Ren
49f723a3dd Optimize .unwrap_or() and .expect() usages (#374) 2019-06-18 23:12:13 -04:00
Christian Legnitto
9c9e3da72d Release juniper 0.12.0 2019-05-16 19:03:21 -07:00
Christian Legnitto
8a047e8702 Release juniper_codegen 0.12.0 2019-05-16 19:01:52 -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
520cac29a0
(codegen) Allow #[deprecated] on field in impl_object 2019-05-13 12:37:22 +02:00
Christoph Herzog
552b4d01ac
(codegen) Fix test dependency version to be exact.
Needed for releasing automation.
2019-05-12 21:03:52 +02:00
Christoph Herzog
de12e0eba5
Formatting... 2019-05-12 10:49:46 +02:00
Christoph Herzog
67b28c5e89
(codegen) Remove (extern crate self) declaration 2019-05-12 10:36:30 +02:00
Christoph Herzog
758f3f7d40
(codegen) Implement impl_object macro + unify code with object derive
This commit implements a new proc macro `impl_object` that replaces
the old graphql_object! macro.

The code shares a lot of similarities with the GraphQLObject
custom derive, so the code was unified to handle both
more generically.

Also, doc comment processing was standardized and improved.
2019-05-12 10:35:03 +02:00
Christian Legnitto
794568e463
Add release automation (#346)
See `RELEASING.md` for directions
2019-05-11 23:51:28 -07:00
Christoph Herzog
2e011014ea
Formatting... 2019-05-02 18:44:56 +02: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
Christoph Herzog
4f72a61346 Formatting... 2019-03-23 14:44:48 +01:00
Christoph Herzog
8c5b86e1c6 Allow specifying the Context type in #[derive(GraphQLObject)]
This commit extends the GraphQLObject derive to allow specifying a
custom context type.
2019-03-08 11:47:13 +01:00
Christian Legnitto
52fb87aaf4 Run cargo fmt on latest stable 2019-01-28 20:28:03 +01:00
Christian Legnitto
9b021b2fe7 Keep ScalarValue but mark it as deprecated 2018-12-19 20:17:17 +01:00
Christian Legnitto
88c17db8c3 Rename ScalarValue derive
Fixes https://github.com/graphql-rust/juniper/issues/299.
2018-12-19 20:17:17 +01: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
Christoph Herzog
2f5e3ab29b 0.11.1 Release
* Changelog
* Cargo.toml version bumps
2018-12-19 03:53:33 +01:00
Christoph Herzog
8dd2eafef8 Add *Internal custom derive variants for juniper crate
Currently, custom derives inside the main juniper crate are supported by
an ugly hack using the __juniper_use_everything macro.

This commit adds new custom derive variants that are for
main juniper crate internal use only (GraphQL{Enum,InputObject}Internal.

All custom derives inside the juniper crate are refactored to use the
new '*Internal' derives.

This allows us to
* remove the use_everything macro,
* simplify the generated code for custom derives
* support the Rust 2018 edition
2018-12-19 03:53:33 +01:00
Christian Legnitto
56954b15dc Fix publishing juniper atfter juniper_codegen 2018-12-17 14:49:27 -08:00
Christian Legnitto
8b2ec00a92 Bump juniper_codegen version to 0.11.1-pre 2018-12-17 14:43:57 -08:00
Christian Legnitto
2502c1b6da Set up some release automation.
Partially fixes https://github.com/graphql-rust/juniper/issues/248.

* Install `cargo-release`. (currently need a patched one with https://github.com/sunng87/cargo-release/pull/74)
* Run `cargo make release-dry-run` to do a dry run of a release
* Run `cargo make release` to do a minor versioned release of every crate
* Run `cargo make release-patch` to do a patch release of every crate

To only release one crate:
* Change directories into the desired crate
* Point `cargo-make` to the workspace-level Makefile when running a command. For example, `cargo make --makefile ../Makefile.toml release-dry-run`.

From the workspace root, run `cargo
2018-12-17 13:45:56 -08:00
Christian Legnitto
73175d7a10 Bump version 2018-12-17 13:11:21 -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
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
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
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
Christoph Herzog
56f71e934b Format code 2018-07-19 16:18:49 +02:00
Christian Legnitto
4be687f73e Add more unit tests for doc comments as descriptions 2018-06-20 20:45:34 +02:00