Commit graph

1039 commits

Author SHA1 Message Date
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
Kunjan Dalal
0dcfb850e1
failure removed in favour of thiserror and anyhow (#696) 2020-07-10 22:02:32 -10:00
Christian Legnitto
61cb75969e
Move and enable public api integration tests (#692) 2020-07-08 16:40:34 -10:00
Christian Legnitto
de3a79a142
Update CHANGELOG.md 2020-07-05 19:54:08 -10:00
Kai Ren
4d77a1a9b9
Strip redundant Send/Sync bounds (#688)
Additionally:
- strip redundant type parameters for juniper::Context in some core definitions and reuse associated type
2020-06-30 18:13:15 +03:00
Kai Ren
7578175baf
Remove internal versions of proc macros (#687)
- generate always `::juniper::` crate path in proc macros and use `extern crate self` to make it work inside `juniper`
- add optional non-documented `internal` proc macro argument to proc macros, which allows double-underscored names and is used inside `juniper` only
2020-06-30 12:26:48 +03:00
Kai Ren
35b804c37b
Decouple object safe part from GraphQLType traits (#685)
- add object safe GraphQLValue, GraphQLValueAsync and GraphQLSubscriptionValue traits containing methods for value resolution
- refactor GraphQLType, GraphQLTypeAsync and GraphQLSubscriptionType traits to register and provide GraphQL type information only
2020-06-30 11:20:21 +03:00
Christian Legnitto
ed6b257e58
Small typo changes to CHANGELOG 2020-06-27 23:52:28 -10:00
Christian Legnitto
c7cc1daed2
Update CHANGELOG.md 2020-06-27 21:41:24 -10:00
Christian Legnitto
03844468f7
Fix minor CHANGELOG typos 2020-06-27 21:38:19 -10:00
Christian Legnitto
54860880d9
Reword changelog 2020-06-27 21:34:54 -10:00
Alexander Lyon
714d602fb9
Update to_camel_case to respect the rust convention of prefixing '_' for unused vars (#684) 2020-06-27 20:15:19 -10:00
imspace
37a37d462f
fix: endless poll on an errored ws stream (#683)
* fix: endless poll on an errored ws stream
2020-06-24 18:23:13 -10: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
tyranron
563270d975
Fix 'juniper_rocket_async' crate up to latest upstream changes 2020-06-23 14:17:27 +03:00
tyranron
5b4f6fca39
Fix formatting of 'juniper_subscriptions' crate 2020-06-23 13:38:30 +03:00
tyranron
3cd4cbb0b8
Fix lifetime mismatch in 'juniper_subscriptions' crate 2020-06-23 13:31:33 +03:00
Joao Neves
f19d498254
Upgrade reqwest to 0.10 version and use rustls to remove transitive OpenSSL (#677)
- revive `warp_async` example (#659)

Co-authored-by: Allan Calix <contact@allancalix.com>
Co-authored-by: Kai Ren <tyranron@gmail.com>
2020-06-14 16:29:08 +03:00
Chris
6dd6abbadc
Fix custom ScalarValue usage for unions (#681)
- make GraphQLUnion trait generic over ScalarValue
- generate generic over ScalarValue impls of GraphQLUnion trait
- add codegen tests with a custom ScalarValue for union macros
2020-06-14 14:12:53 +03:00
Kai Ren
5b9c6111f1
Relax redundant 'static lifetime bounds on ScalarValue in juniper_subscriptions::Coordinator (#680) 2020-06-10 21:27:58 -10:00
Nathan Wilson
7365b0fdd8
Upgrade bson crate to 1.0 (#678) 2020-06-10 12:34:56 +03:00
tyranron
5b7706e839
Fix codegen failure tests for the latest nightly Rust 2020-06-10 11:36:36 +03: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
Jordão Rodrigues Oliveira Rosario
40ad17c540
Normalize subscriptions endpoint in graphiql_source (#628)
The objective here is to make the Playground and GraphiQL have the same behavior with the endpoint arguments.
2020-06-05 00:45:19 +03:00
Nathan Wilson
5cf21bf41b
Fix PR #662's entry in CHANGELOG pointed to incorrect link (#675) 2020-06-04 23:46:14 +03:00
Nathan Wilson
02801ee981
Upgrade bson crate to 0.15.0 (#674) 2020-06-04 23:40:06 +03: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
Teymour Aldridge
31d08888e4
Make some comments clearer. (#665) 2020-05-23 20:29:58 -10:00
Caio
2cb96d0fc4
impl GraphQLScalar for NaiveTime (#657)
* impl GraphQLScalar for NaiveTime

* Add feature
2020-05-20 22:13:31 -10:00
Caio
0bb1c5beac
Relax Default impl constraint (#664)
* Relax Default impl constraint

For EmptyMutation and EmptySubscription. The built-in derive
expects `T: Default`, which is not necessary for a PhantomData
wrapper.

* Add test
2020-05-19 05:46:56 -10:00
bumblepie
5021ae80e1
Improve lookahead visibility for aliased fields (#662)
* Improve lookahead visibility for aliased fields
- Add a method to access the children of look ahead structs
- Make the behaviour around accessing aliased lookahead fields more consistent

* Deprecate old Lookahead methods for accessing child selections
2020-05-16 21:43:37 -10:00
Julio Daniel Reyes
91a3353983
Update dataloader explanation code (#661) 2020-05-13 16:37:14 -10:00
Kai Ren
aedb2d1eb4
Support "Content-Type: application/graphql" (#426) (#654)
* Support 'application/graphql' POST requests for 'juniper_warp'

* Add integration tests for 'application/graphql' POST requests and revive HttpIntegration test suite for 'juniper_warp'

* Support 'application/graphql' POST requests for 'juniper_hyper' and run its tests for both sync and async versions

* Run integration tests for both sync and async versions of 'juniper_warp' and update its CHANGELOG

* Support 'application/graphql' POST requests for 'juniper_iron'

* Fix 'application/graphql' POST requests support for 'juniper_actix'

* Support 'application/graphql' POST requests in 'juniper_rocket' and 'juniper_rocket_async'

* Upd juniper's CHANGELOG
2020-05-08 06:00:49 -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
Christian Legnitto
358ca27d28
Fix panic with invalid unicode query (#645)
Without this fix the panic looks like the following:

```rust
---- parser::tests::lexer::string_errors stdout ----
thread 'parser::tests::lexer::string_errors' panicked at 'byte index 4 is not a char boundary; it is inside 'ɠ' (bytes 3..5) of `"\uɠ^A`', src/libcore/str/mod.rs:2219:5
```

This was found via fuzzing with `cargo-fuzz`.
2020-04-30 16:08:23 -10:00
Kai Ren
52aea4d68d
Disallow deserialize empty GraphQLBatchRequest (#639) (#644)
* Disallow deserialize empty GraphQLBatchRequest (#639)

* Add test for empty batch request
2020-04-30 06:16:15 -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
Kai Ren
79c265f027
Remove direct usage of 'serde_derive' crate and redundant usage of 'serde' crate (#640) 2020-04-28 06:39:35 -10:00
Byeongjee Kang
c761d91c69
Fix a minor typo in comment (#637) 2020-04-27 18:09:00 -10:00
Kai Ren
9064d7f523
Avoid unnecessary Vec allocation when executing GraphQLBatchRequest (#638)
Additionally:
- make GraphQLBatchRequest/GraphQLBatchResponse code a bit more laconic
2020-04-27 18:08:27 -10:00
Byeongjee Kang
dc4cdf0bf5
Fix deprecated comments (#635)
build_*_type methods return meta types directly.
They don't return builders.
2020-04-26 20:28:05 -10:00
Christian Legnitto
892619a35b
Fix typos in dataloader docs 2020-04-25 20:26:16 -10:00
Christian Legnitto
9e554981ee
Add actix to readme 2020-04-21 07:31:35 -10:00
Jordão Rodrigues Oliveira Rosario
a47d1c5430
Add actix-web integration (#603) 2020-04-20 20:21:02 -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