Commit Graph

1027 Commits

Author SHA1 Message Date
Sunli
f33ab0af01 Inline ContainerType, EnumType, ScalarType to docs. 2020-10-01 10:05:16 +08:00
Sunli
19f05597e0 Merge master 2020-10-01 09:40:04 +08:00
Sunli
1e30712726 Merge branch 'master' into rework-errors 2020-10-01 09:39:47 +08:00
Sunli
e6108352b9 Merge branch 'master' into rework-errors 2020-10-01 09:07:19 +08:00
Koxiaet
b61088089b Fix compilation and tests 2020-09-30 19:40:17 +01:00
Koxiaet
ab82460b81 Merge master 2020-09-30 18:24:24 +01:00
Sunli
c35a9f7245 Only delete the graphql attribute on the field parameter. 2020-09-30 16:18:49 +08:00
Sunli
28cd37115f Update docs. 2020-09-30 11:55:56 +08:00
Sunli
fd4c2b193b Added Apollo persisted queries extension. #280 2020-09-30 11:37:12 +08:00
Sunli
79d0c80d8b Update Cargo.toml 2020-09-30 08:00:48 +08:00
Sunli
6492629e71 Improve trait for GraphQL types. 2020-09-30 07:45:48 +08:00
Koxiaet
2ddaaaa07f 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
af2e480b70 Added context for Extension. 2020-09-29 20:47:37 +08:00
Sunli
c0ddf55132 Keep pin-project-lite dependent on async-graphql-tide at v0.1.8. 2020-09-29 17:04:27 +08:00
Sunli
f23942d798 2.0.0-alpha.21 2020-09-29 16:40:35 +08:00
Sunli
8c5d8f0324 Rework async-graphql-derive. #288 2020-09-29 16:06:10 +08:00
Sunli
e42f5a4477 Update book. 2020-09-28 14:43:12 +08:00
Sunli
fb026588ad 2.0.0-alpha.20 2020-09-28 11:33:58 +08:00
Sunli
884bf77087 Update docs 2020-09-28 11:15:37 +08:00
Sunli
c460431715 Add feature to flatten nested GraphQL unions. #286 2020-09-28 11:13:46 +08:00
Sunli
254502e7e2 Remove useless code. 2020-09-28 09:56:15 +08:00
Sunli
a0905de86f Update docs 2020-09-28 09:31:19 +08:00
Sunli
3a4f1aee15
Merge pull request #285 from chipsenkbeil/patch-1
Add remote enum documentation
2020-09-28 09:17:59 +08:00
Chip Senkbeil
b9359df3f6
Add remote enum documentation
Add book documentation about remote option for enums (#276)
2020-09-27 14:02:10 -05:00
Sunli
3f654127b8 Clippy clean. 2020-09-27 19:29:23 +08:00
Sunli
4bbb30b2ae Update schema.rs 2020-09-27 19:13:12 +08:00
Sunli
bf42c4e915 Fixed variables cannot deserialize from null. #282 2020-09-27 19:10:49 +08:00
Sunli
e9efad4479 Fix the problem when generating Federation SDL. #283 2020-09-27 18:49:04 +08:00
Sunli
397650bb0d Update docs 2020-09-27 18:22:01 +08:00
Sunli
2fc4750122 Add remote attribute for Enum macro. #276 2020-09-27 18:19:11 +08:00
Sunli
17240f1fed Add some type detection to make the defined schema conform to the GraphQL specification. #282 2020-09-27 15:35:05 +08:00
Sunli
fc495d1439 2.0.0-alpha.19 2020-09-27 10:22:13 +08:00
Sunli
9b4fc7d922 Make Object and Subscription macros support #cfg(...) attribute. #281 2020-09-27 10:20:20 +08:00
Sunli
39f8a4fa17 Invoke extensions for execute_schema. 2020-09-26 15:52:59 +08:00
Sunli
3b24499db2 2.0.0-alpha.18 2020-09-26 12:36:56 +08:00
Sunli
9333583483 Improve the error message of Tracing extension. 2020-09-26 12:35:28 +08:00
Sunli
e44cb6886f Update readme 2020-09-26 11:25:21 +08:00
Sunli
f4df7d57f8 When an error occurs in the query, the Tracing extension can output the error message. 2020-09-26 09:49:46 +08:00
Sunli
d851964a53 2.0.0-alpha.17 2020-09-26 09:38:07 +08:00
Sunli
2ac69e2e29 Add StringNumber type. 2020-09-26 09:22:54 +08:00
Sunli
1cab6d0186 Remove unnecessary features for tide and warp integrations. 2020-09-26 08:35:17 +08:00
Koxiaet
c55e82bc80
Merge pull request #279 from robjtede/patch-1
do not include default features for actix-web
2020-09-25 19:54:21 +01:00
Koxiaet
dbbf0c1969 Fix Tide tests 2020-09-25 19:50:04 +01:00
Rob Ede
809b99384c
do not include default features for actix-web 2020-09-25 19:16:15 +01:00
Koxiaet
0351342822 Add integrations README 2020-09-25 18:25:52 +01:00
Koxiaet
7b18bd5f80 Support batch requests in Tide 2020-09-25 18:03:51 +01:00
Koxiaet
38c9c718d6 Reduce code duplication in batches in actix web 2020-09-25 17:38:12 +01:00
Sunli
8b97141779 2.0.0-alpha.16 2020-09-25 17:02:15 +08:00
Sunli
2c693e1245 Make uuid to optional dependent. 2020-09-25 15:40:04 +08:00
Sunli
68965e5a0c Add data_XXX methods to ResolveInfo and remove context field from ResolveInfo. #260 2020-09-25 15:26:29 +08:00