Commit graph

72 commits

Author SHA1 Message Date
Kai Ren
a3fda7363d
Rework codegen for GraphQL objects and subscriptions (#971, #421)
- preserve and reuse defined impl blocks in #[graphql_object] and #[graphql_subscription] macros expansion
- allow renaming `ScalarValue` type parameter in expanded code via `scalar = S: ScalarValue` syntax

Additionally:
- rename `rename` attribute's argument to `rename_all`
- support `rename_all` in #[graphql_interface] macro
2021-08-11 17:41:49 +03:00
Christian Legnitto
1146a01331
Use actix betas to allow publishing on crates.io (#954) 2021-07-06 16:23:41 -07:00
Jordão Rodrigues Oliveira Rosario
739cc3bfc2
Upgraded tokio, warp, hyper and actix (#912)
* Upgraded tokio, warp, hyper and actix

* Code formatting

* actix-web temporary version fix specification

* Error handling fix on juniper_rocket

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2021-06-28 20:22:45 -10:00
Rob Ede
57165b33a0
Update third-party examples in book (#898)
* Update third-party.md

* Update third-party.md

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2021-03-29 19:30:24 -10:00
Alex Touchet
06b1fbce0c
Update iron link (#890) 2021-03-01 17:26:44 -10:00
Nicolas Bonnet
4467b29153
Add missing use declaration in Quickstart (#838)
Seems like the example code in the quickstart guide is missing an use declaration. 

The code fails to compile: `error: cannot find macro `graphql_value` in this scope` with `rustc 1.48.0 (7eac88abb 2020-11-16)`
2020-12-28 07:45:40 -10:00
Kai Ren
3472fe6d10
Fix attributes naming on fields and arguments for interfaces and unions (#806)
Additionally:
- revive macros/tests/object
- revive executor_tests/interfaces_unions
2020-11-14 15:41:01 +02:00
Kai Ren
a4871887bb
Default to generic ScalarValue in #[graphql_object] macro (#779)
* Change codegen ScalarValue defaults for #[graphql_object] macro

* Fix integration tests

* Fix codegen failure tests

* Fix 'juniper' crate tests

* Fix integration crates tests

* Fix 'juniper_benchmarks' crate

* Fix examples

* Fix Book

* Fix

* Add CHANGELOG entry

* Some Book corrections

* Fix

* Bootstrap coercion machinery

* Reimpl coercion

* Correct tests, vol.1

* Correct tests, vol.2

* Correct tests, vol.3

* Correct tests, vol.4

* Correct tests, vol.5

* Fix coercion for subscriptions

* README fixes

Co-authored-by: Christian Legnitto <christian@legnitto.com>
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-11-06 18:15:18 -08:00
Chris
cd66bdb450
Add ability to distinguish between implicit and explicit null (#795)
* add Nullable to distinguish between implicit and explicit null

* cargo fmt

* add page to book

* address comment
2020-10-23 19:21:37 -04:00
Kai Ren
421b343398
Remove redundant extern crate usages (#790)
Additionally:
- remove obsolete benches in benches/ dir
- restore benches in juniper/benches/ dir
2020-10-19 19:42:27 +03:00
tyranron
6d4a0a8709
Fill up missing docs for #[graphql_interface] macro (#682) 2020-10-07 10:09:01 +02:00
tyranron
b1a0366112
Fix interfaces description in Book (#682, #658) 2020-10-06 11:58:30 +02:00
Kai Ren
cbf16c5a33
Make interfaces great again! (#682)
* Bootstrap

* Upd

* Bootstrap macro

* Revert stuff

* Correct PoC to compile

* Bootstrap #[graphql_interface] expansion

* Bootstrap #[graphql_interface] meta parsing

* Bootstrap #[graphql_interface] very basic code generation [skip ci]

* Upd trait code generation and fix keywords usage [skip ci]

* Expand trait impls [skip ci]

* Tune up objects [skip ci]

* Finally! Complies at least... [skip ci]

* Parse meta for fields and its arguments [skip ci]

- also, refactor and bikeshed new macros code

* Impl filling fields meta and bootstrap field resolution [skip ci]

* Poking with fields resolution [skip ci]

* Solve Rust's teen async HRTB problems [skip ci]

* Start parsing trait methods [skip ci]

* Finish parsing fields from trait methods [skip ci]

* Autodetect trait asyncness and allow to specify it [skip ci]

* Allow to autogenerate trait object alias via attribute

* Support generics in trait definition and asyncify them correctly

* Temporary disable explicit async

* Cover arguments and custom names/descriptions in tests

* Re-enable tests with explicit async and fix the codegen to satisfy it

* Check implementers are registered in schema and vice versa

* Check argument camelCases

* Test argument defaults, and allow Into coercions for them

* Re-enable markers

* Re-enable markers and relax Sized requirement on IsInputType/IsOutputType marker traits

* Revert 'juniper_actix' fmt

* Fix missing marks for object

* Fix subscriptions marks

* Deduce result type correctly via traits

* Final fixes

* Fmt

* Restore marks checking

* Support custom ScalarValue

* Cover deprecations with tests

* Impl dowcasting via methods

* Impl dowcasting via external functions

* Support custom context, vol. 1

* Support custom context, vol. 2

* Cover fallible field with test

* Impl explicit generic ScalarValue, vol.1

* Impl explicit generic ScalarValue, vol.2

* Allow passing executor into methods

* Generating enum, vol.1

* Generating enum, vol.2

* Generating enum, vol.3

* Generating enum, vol.3

* Generating enum, vol.4

* Generating enum, vol.5

* Generating enum, vol.6

* Generating enum, vol.7

* Generating enum, vol.8

* Refactor juniper stuff

* Fix juniper tests, vol.1

* Fix juniper tests, vol.2

* Polish 'juniper' crate changes, vol.1

* Polish 'juniper' crate changes, vol.2

* Remove redundant stuf

* Polishing 'juniper_codegen', vol.1

* Polishing 'juniper_codegen', vol.2

* Polishing 'juniper_codegen', vol.3

* Polishing 'juniper_codegen', vol.4

* Polishing 'juniper_codegen', vol.5

* Polishing 'juniper_codegen', vol.6

* Polishing 'juniper_codegen', vol.7

* Polishing 'juniper_codegen', vol.8

* Polishing 'juniper_codegen', vol.9

* Fix other crates tests and make Clippy happier

* Fix examples

* Add codegen failure tests, vol. 1

* Add codegen failure tests, vol. 2

* Add codegen failure tests, vol.3

* Fix codegen failure tests accordingly to latest nightly Rust

* Fix codegen when interface has no implementers

* Fix warnings in book tests

* Describing new interfaces in Book, vol.1

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-10-05 21:21:01 -10:00
Camille TJHOA
1e733cc793
Fix context in quickstart (#772) 2020-10-01 07:14:01 -10:00
Thomas Radloff
092a9851fb
Fix version. (#755)
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-09-10 22:20:27 -10:00
Christian Legnitto
61bc35251f
Fix book tests (#711) 2020-07-18 15:24:33 -10:00
Christian Legnitto
de1b332792
Quickstart comments should mention subscriptions. 2020-07-18 13:29:48 -10:00
Christian Legnitto
c4319b6449
Update quickstart.md 2020-07-15 21:24:57 -10:00
Christian Legnitto
5ddd2d499f
Add heading for error handling and point to spec
Fixes https://github.com/graphql-rust/juniper/issues/695.
2020-07-15 21:09:19 -10:00
Christian Legnitto
61a5a747f1
Update subscriptions.md 2020-07-14 21:02:30 -10:00
Christian Legnitto
8c3857d772
Update schemas_and_mutations.md 2020-07-14 20:45:42 -10:00
Christian Legnitto
480eda9846
Update schemas_and_mutations.md 2020-07-14 20:41:08 -10:00
Andres Rodriguez
f0ee2094d3
chore(docs): fix typo in complex fields section (#698) 2020-07-14 23:03:39 +03:00
Christian Legnitto
a08ce0760d
Add note about i64/u64 to the book
Fixes https://github.com/graphql-rust/juniper/issues/671
2020-06-23 22:41:09 -10:00
Christian Legnitto
9167654a73
Add support for GraphQL Schema Language (#676)
Co-authored-by: Alexander Lyon <arlyon@me.com>
2020-06-05 17:43:11 -10:00
Kai Ren
ddc1488195
Codegen reimplementation for GraphQL unions (#666)
- reimplement #[derive(GraphQLUnion)] macro to support:
    - both structs and enums
    - generics in type definition
    - multiple #[graphql] attributes
    - external resolver functions
- remove From trait impls generation for enum variants

- reimplement #[graphql_union] macro to support:
    - traits
    - generics in trait definition
    - multiple attributes
    - external resolver functions
    - GraphQLType implemetation for a raw trait object
    - GraphQLTypeAsync implemetation (#549)

- add marker::GraphQLUnion trait

- rewrite "2.5 Unions" section in Book (Juniper user documentation)

- rewrite `codegen` and `codegen_fail` integration tests for GraphQL unions

Additionally:
- re-export `futures` crate in `juniper` for convenient reuse in the generated code without requiring library user to provide `futures` crate by himself (#663)
- use unit type () as default context for EmptyMutation and EmptySubscriptions
- relax Sized trait bound on some GraphQLType and GraphQLTypeAsync definitions, implementations and usages
2020-06-04 11:19:01 +03:00
Julio Daniel Reyes
91a3353983
Update dataloader explanation code (#661) 2020-05-13 16:37:14 -10:00
Jonas Meurer
845331033e
Documented Alternative Error Handling (#634)
* Added alternative error handling

* Fixed book tests and some sentences

* Apply suggestions from code review

Co-Authored-By: Christian Legnitto <LegNeato@users.noreply.github.com>

* Fixed book examples

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-04-28 06:41:19 -10:00
Christian Legnitto
892619a35b
Fix typos in dataloader docs 2020-04-25 20:26:16 -10:00
André Isaksson Kraft
2ba9f71b0c
Make graphql_scalar a proc macro (#610)
Fixes #571

Signed-off-by: andrisak <andrisak@gmail.com>

* Replaced the old macro with the new proc macro.
Updated documentation.

Signed-off-by: andrisak <andrisak@gmail.com>

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-04-20 10:15:09 -10:00
Jonas Meurer
fe99e1cc70
Allow specifying scalar and context for GraphQLEnum (#621)
* Updated implementation of derive enum

- allows context specification
- allows scalar specification
- shares code with derive object

* Added this feature to CHANGELOG

* Added matrix with supported macro attributes for enums

* Added case which checks for custom context

* GraphQLUnion now can use a different context per variant

* Moved context switch test for union into right folder

* Sync resolve expression has the same form as the other impls

* Disabled custom scalar on GraphQLEnum

* Fixed CHANGELOG

* Fixed support matrix of GraphQLEnum in the book

- scalar not supported!
- skip not supported!

* Added test case for "noasync" derive attribute

* Disallowed generics and lifetimes on GraphQLEnum

* Added error message for duplicate naming

* Added error message for empty variant
2020-04-17 19:09:04 -10:00
Jordão Rodrigues Oliveira Rosario
7e8724751f
Initial implementation of Subscription Docs (#609)
Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-04-16 20:16:00 -10:00
Jonas Meurer
a05f4e55c4
Derive macro for tagged enums (GraphQLUnion) (#618)
* Implemented device macro for GraphQLUnion's

* Updated PR link in CHNAGELOG

* Disabled documentation on enumeration fields

* Disabled skip on fields

* Changed implementation for std::convert::Into since skip is not possible

* Added documentation for GraphQLUnion

* Added tests for GraphQLUnion

* Fixed typos in error messages (as suggested by review)

* Fixed failing documentation example

* Utilized `resolver_code` in `util::GraphQLTypeDefinitionField`.

Simplifies code and provides the idea of using
`util::GraphQLTypeDefinitionField` for different types than objects.

* Removed wrong statement about skip annotation in docs.

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-04-14 21:58:45 -10:00
Yusuke Sasaki
a275c8dcc2
doc: remove outdated examples from third-party integrations list (#572) 2020-03-18 20:46:32 -07: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
e9b8aa2c38
Rename execute -> execute_sync, execute_async -> execute (#556) 2020-03-09 22:40:26 -07:00
Christian Legnitto
00b111a1ff
Remove async feature gate (#554)
This still has the async / non-async split. Future diffs will get
rid of `GraphQLTypeAsync` and move everything into `GraphQLType`.
2020-03-08 23:20:11 -07:00
Félix Gagnon-Grenier
15e9bffa84
Warning about normal methods (#545)
There's a comment [here](https://docs.rs/juniper/0.14.2/juniper/attr.object.html) that only GraphQL fields can be specified in `#[juniper::object]` impl block, yet in the book it was not specified, I needed help to get the idea to try it.

I simply copied that information because it feels important.

Co-authored-by: Christian Legnitto <LegNeato@users.noreply.github.com>
2020-03-04 08:58:52 -08:00
Victor-Nicolae Savu
f5e4b6b9b6
Match the list of integrations to the page order (#548)
* Remove duplicate link to Hyper integration

The `Adding a Server` page contains a duplicate link to `Hyper`. The first of them can cause the reader to accidentally skip the `Rocket` and `Iron` integration pages because their pages are before the one for `Hyper` in the reading order. 

Remove the first link so that the list of official server integrations matches the page order.

* Match the list of integrations to the page order

In the book, the pages for the official integrations appear in the order: `Warp`, `Rocket`, `Iron`, `Hyper`, but on the `Official Server Integrations` page they are listed with `Hyper` first. This can cause readers to accidentally skip the other three integrations if they click on the link for `Hyper` first. 

Move `Hyper` to the bottom of the list to match the reading order of the book.

* Remove unnecessary blank line
2020-03-02 09:57:17 +01:00
Christian Legnitto
8925f64983
Temporarily disable interface tests (#543)
These aren't reimplemented yet as proc macros. Disabling them
so book tests on PRs pass and the website is updated.
2020-02-20 23:21:41 -07:00
Nathan Wilson
389fd5ca19
Add bson crate's ObjectId to juniper foreign scalar type integrations (#517) 2020-02-12 23:49:50 -07:00
James H
df2740393a
Add dataloader explaination to book (#518) 2020-02-12 23:45:15 -07:00
tyranron
c51c675306
Use caret requirement for specifying 'futures' crate version 2020-02-04 09:57:47 +01:00
tyranron
dd9c201352 Upgrade uuid to 0.8 version 2020-01-29 01:59:42 -05:00
Andy Swan
ab498f2f24
fixing a double spell 2020-01-28 11:07:25 +00:00
Christian Legnitto
31ca3e6156 Add async to doc tests 2020-01-21 08:38:13 -08:00
Christian Legnitto
73dc5cd5b8 Release juniper 0.14.2 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
Klaus Purer
4a91d9d205 docs(quickstart): Fix juniper version so the examples work 2020-01-18 17:14:35 -08:00
Christoph Herzog
ce3cf45ca9 Rename object proc macro to graphql_object 2019-11-16 02:57:48 +01:00