Commit Graph

31 Commits

Author SHA1 Message Date
Sunli
88ba75ec70 Rework connection types 2022-04-19 19:18:06 +08:00
Sunli
c2feefdf09 Fix the problem that some integrations overwritten HTTP headers. #793 2022-01-24 14:14:07 +08:00
Sunli
97464b0572 Update async-graphql-rocket 2021-11-12 21:35:47 +08:00
Sunli
7771d4e08f Attach custom HTTP headers to the response when an error occurs. #572 2021-07-15 08:20:08 +08:00
XiNiHa
6c15107ad4 Update rocket to 0.5.0-rc.1 2021-06-16 16:39:09 +09:00
Sunli
d82eb01cfd Update lib.rs 2021-05-29 22:36:01 +08:00
Daniel Wiesenberg
ff2e7e272d Point Rocket to repo with arangors included 2021-05-19 15:44:48 +02:00
Hugo Saracino
48ddc203e1 Update rocket integration with new FromForm query parser 2021-03-30 16:50:35 +02:00
Sunli
b054fc0704 Add Send + Sync constraints for InputType, OutputType and SubscriptionType. 2021-01-14 12:41:59 +08:00
Sunli
a5eeafce3f Bump rocket 2021-01-14 12:01:26 +08:00
Naaman
f92dda0271 Update http-headers to use http::HeaderMap 2021-01-10 10:57:28 +00:00
Sunli
1e449f9da6 Add Context::set_http_header method. #370 2021-01-10 08:06:48 +08:00
Daniel Wiesenberg
363508f6fa Add route ranking to rocket integration docs 2020-10-26 08:34:00 +01:00
Koxiaet
ed2b73949a Update dependencies and make examples submodule 2020-10-15 20:48:06 +01:00
Koxiaet
75be2c5d7f Require JSON content-type 2020-10-15 18:30:16 +01:00
Koxiaet
7471537036 Improve Rocket integration
This is breaking, but since updating Rocket is also breaking I think
it's fine not to bump the major version number.
2020-10-15 18:19:20 +01:00
Sunli
97f0b0d419 Merge branch 'master' into rework-errors 2020-10-01 09:07:19 +08:00
Koxiaet
768b666acd Merge master 2020-09-30 18:24:24 +01: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
Sunli
e60864a18d Rework async-graphql-derive. #288 2020-09-29 16:06:10 +08:00
Sunli
451f425813 Remove all GQL prefix. #208 2020-09-20 13:44:20 +08:00
Sunli
e645e9d999 Remove the GQL prefix of all macros. #208 2020-09-18 09:10:24 +08:00
Koxiaet
9796364348 Move websockets to http module and fix doc tests 2020-09-13 07:40:34 +01:00
Koxiaet
dcc7d1be14 Replace http::GQLRequest with Request 2020-09-12 17:07:46 +01:00
Koxiaet
35e74a4e17 Create resolver_utils 2020-09-12 10:29:52 +01:00
Sunli
3c01c5ed28 Update book. 2020-09-11 23:38:18 +08:00
Sunli
69e6e7997d async-graphql-rocket 2.0 2020-09-11 22:55:01 +08:00
Sunli
f3c0d86f12 Continue to refactor. 2020-09-10 16:39:43 +08:00
Sunli
ce0683e1f9 Initial attempt. 2020-09-10 12:49:08 +08:00
Sunli
668b1fea94 Remove prefixes and add integrations subdirectory #259 2020-09-09 10:08:17 +08:00