Commit Graph

123 Commits

Author SHA1 Message Date
Erik Tesar
42548ce04b feat: implement cbor in multipart 2021-09-02 15:27:44 +02:00
Erik Tesar
deef5cee4b style: cargo fmt
please note that clippy probably will still fail, because this fork was created before c80687af80
2021-09-02 13:37:18 +02:00
Erik Tesar
d9cb3b91be fix: ParseRequestError::InvalidFilesMap now is dyn std::error::Error 2021-09-02 12:21:34 +02:00
Erik Tesar
5ffcf8c36a decide which decoder to use based on content-type 2021-07-31 14:52:56 +02:00
Erik Tesar
63e423a178 always use cbor methode for deserialization 2021-07-28 17:37:47 +02:00
Erik Tesar
c88f4bbd0e try to use cbor decoding 2021-07-27 21:37:30 +02:00
Miaxos
02df4f1c24 misc: boxed error 2021-07-26 17:32:49 +00:00
cloudybyte
37e6a1b715 try to add cbor support 2021-07-26 17:29:52 +02:00
Tim Maddison
f318e02610 Reformat 2021-07-23 10:09:02 +01:00
Tim Maddison
fa218b435e Change with_setting to accept any JSON value 2021-07-23 09:44:04 +01:00
Sunli
2dce1ad35f Clippy clean 2021-06-18 10:43:34 +08:00
Sunli
c7c7e3ad05 Remove the static constraint of the receive_body and receive_batch_body functions. #544 2021-06-16 17:20:41 +08:00
Sunli
588a7e40e8 Bump multer from v1.2.2 to v2.0.0 2021-06-07 14:07:53 +08:00
Oscar Beaumont
ac8c5497f7 style:linted code 2021-05-18 03:27:50 +08:00
Oscar Beaumont
cbfd46e890 Allow the ability to set GraphQL Playground settings 2021-05-14 15:16:23 +08:00
Sunli
63738e9a3a Rustfmt 2021-05-08 14:10:59 +08:00
D1plo1d
ed8332ec90 feat: Websocket::with_message_stream added for developers to experiment with File Uploads over WebSockets 2021-05-06 20:08:28 -04:00
Utkarsh Kukreti
a7f662e4a5 add missing fonts to http::playground_source's html
graphql-playground uses Open Sans and Source Code Pro and its README
suggests adding this snippet [1].

[1]: https://github.com/graphql/graphql-playground#use
2021-04-18 03:03:29 +05:30
Sunli
05911f3516 Rework Extension & TracingExtension & OpenTelemetryExtension 2021-03-26 12:03:10 +08:00
Sunli
c2c2868b64 Fix internal context missing when there's no connection_init frame. #451 2021-03-24 17:24:12 +08:00
Sunli
1c32a8afcb Now all features are not activated by default. 2021-03-22 10:39:17 +08:00
Sunli
d0fe7fc23b Remove unnecessary Box from WebSocket messages. 2021-03-09 12:07:12 +08:00
puh
f77b34356e Fix typo in multipart stream size limit calculations 2021-02-13 21:50:17 +03:00
Sunli
2d7627cd39 Fixed GraphQL over WebSocket Protocol does not support ConnectionError events. #406 2021-02-06 11:02:41 +08:00
Sunli
d193a138e3 Fixed the bug that can accept subscription requests during the initialization of WebSocket. 2021-02-06 09:24:00 +08:00
Sunli
b98e35995d Supports async websocket initializer. #393 2021-01-16 16:37:20 +08:00
Sunli
b054fc0704 Add Send + Sync constraints for InputType, OutputType and SubscriptionType. 2021-01-14 12:41:59 +08:00
Sunli
46d01db40f Merge branch 'master' into pr/350 2020-12-04 12:17:23 +08:00
Patrick Fernie
e25bcf1c98 use Sec-WebSocket-Protocol header to negotiate protocol 2020-12-03 16:16:07 -05:00
Patrick Fernie
0e711b782e rustfmt fixes 2020-12-02 08:41:12 -05:00
Patrick Fernie
7fb6d7bfbe Add graphql-ws feature for subprotcol selection
On 2020-09-14 a revised version of the [GraphQL over
WebSocket](https://the-guild.dev/blog/graphql-over-websockets) spec was
released as [graphql-ws](https://github.com/enisdenjo/graphql-ws), which
differs from the de facto standard implemented by
[subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws).

This adds a new `cargo` (non-default) feature, `graphql_ws`, which when enabled utilizes the new protocol spec.

Original [subscriptions-transport-ws
protocol](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md)
Revised [graphql-ws
protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md)
2020-12-02 08:13:00 -05:00
Sunli
3a0dda2224 Remove the dependency on bytes crate. 2020-11-30 13:43:17 +08:00
Sunli
d3a00571c0 Clippy clean 2020-11-07 08:24:17 +08:00
Sunli
d95fbb42d9 Fixed a bug that websocket could not push data in a situation. 2020-11-06 22:20:12 +08:00
Sunli
c0323002ea Remove the validation of the content-type by the receive_batch_body function, because this is of little significance. #332 2020-11-01 11:31:54 +08:00
Olexiy Buyanskyy
3ac150bef9 removed not needed namespaces 2020-10-23 13:49:00 +03:00
Olexiy Buyanskyy
baf67f3344 Fixed redundant_closure_for_method_calls
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
2020-10-23 11:10:00 +03:00
Olexiy Buyanskyy
bd966d5ba3 Collected all clippy warnings and fixed 2
https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants

Please change `allow` -> `deny` ub src/lib.rs to see other warnings. I feel some of them are important
2020-10-22 09:38:35 +03:00
Koxiaet
12fe7445c7 Replace futures with futures_util 2020-10-16 07:49:22 +01:00
Koxiaet
4caab70113 Require POST for GraphQL requests 2020-10-15 18:42:09 +01:00
Koxiaet
75be2c5d7f Require JSON content-type 2020-10-15 18:30:16 +01:00
Koxiaet
fff84a3170 Support GET requests in actix-web integration 2020-10-15 10:33:38 +01:00
Koxiaet
93c886af07 Make imports consistent 2020-10-15 07:38:10 +01:00
Sunli
87ba51fdd0 Some improvements. 2020-10-10 16:28:07 +08:00
Sunli
97f0b0d419 Merge branch 'master' into rework-errors 2020-10-01 09:07:19 +08:00
Sunli
35f886a7f8 Improve trait for GraphQL types. 2020-09-30 07:45:48 +08:00
Koxiaet
50009b66ce Rework errors
This completely overhauls the error system used in async-graphql.
- `Error` has been renamed to `ServerError` and `FieldError` has been
renamed to just `Error`. This is because `FieldError` is by far the most
common error that users will have to use so it makes sense to use the
most obvious error name. Also, the current name didn't make sense as it
was used for things other than field errors, such as the data callback
for websockets.
- `ServerError` has been made completely opaque. Before it was an enum
of all the possible errors, but now it just contains an error message,
the locations, the path and extensions. It is a shame that we lose
information, it makes more sense as _conceptually_ GraphQL does not
provide that information. It also frees us to change the internals of
async-graphql a lot more.
- The path of errors is no longer an opaque JSON value but a regular
type, `Vec<PathSegment>`. The type duplication of `PathSegment` and
`QueryPathSegment` is unfortunate, I plan to work on this in the future.
- Now that `ServerError` is opaque, `RuleError` has been removed from
the public API, making it simpler.
- Additionally `QueryError` has been completely removed. Instead the
error messages are constructed ad-hoc; I took care to never repeat an
error message.
- Instead of constructing field-not-found errors inside the
implementations of field resolvers they now return `Option`s, where a
`None` value is representative of the field not being found.
- As an unfortunate consequence of the last change, self-referential
types based on the output of a subscription resolver can no longer be
created. This does not mean anything for users, but causes lifetime
issues in the implementation of merged objects. I fixed it with a bit of
a hack, but this'll have to be looked into further.
- `InputValueError` now has a generic parameter - it's kind of weird but
it's necessary for ergonomics. It also improves error messages.
- The `ErrorExtensions` trait has been removed. I didn't think the
`extend` method was necessary since `From` impls exist. But the
ergonomics are still there with a new trait `ExtendError`, which
is implemented for both errors and results.
- `Response` now supports serializing multiple errors. This allows for
nice things like having multiple validation errors not be awkwardly
shoved into a single error.
- When an error occurs in execution, data is sent as `null`. This is
slightly more compliant with the spec but the algorithm described in
<https://spec.graphql.org/June2018/#sec-Errors-and-Non-Nullability> has
yet to be implemented.
2020-09-29 20:06:44 +01:00
Koxiaet
70d2dbc39c Big improvements to tide integration 2020-09-23 18:30:03 +01:00
Koxiaet
07d2204773 Remove code duplication for batch requests 2020-09-17 19:43:03 +01:00
Koxiaet
d52268523f Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master 2020-09-17 19:23:15 +01:00