Commit Graph

186 Commits

Author SHA1 Message Date
Sunli
bf9e3ec578 Improve depth and complex. 2020-12-18 18:56:28 +08:00
Sunli
c6d8df0bdb Remove async-channel and async-mutex from dependencies. 2020-12-17 10:05:32 +08:00
Sunli
fe24247c9d Add the skip attribute to the InputObject fields. 2020-12-15 20:29:59 +08:00
Sunli
ba23761cb4 Add visible attributes on types, fields, and parameters, allowing some content to be hidden based on conditions. 2020-12-12 16:23:53 +08:00
Sunli
b3bd8603e3 Add tests for graphql-ws. 2020-12-04 16:44:48 +08:00
Sunli
46d01db40f Merge branch 'master' into pr/350 2020-12-04 12:17:23 +08:00
Sunli
4b00f9393a Add websocket subprotocol for actix-web. 2020-12-04 12:13:52 +08:00
Sunli
9b10ebeab5 Fix the problem that the fields of the list are not merged correctly.#345 2020-11-27 10:26:23 +08:00
Sunli
12b3b0ee46 Fix async_graphql::Object does not work when inside macro after rust 1.48.0 2020-11-22 09:53:18 +08:00
Sunli
456f776fdb Merge branch 'master' of github.com:async-graphql/async-graphql 2020-11-04 10:26:04 +08:00
Sunli
194a2ff100 Fix the problem that Description derived macro do not support generic objects. 2020-11-04 10:25:30 +08:00
Sunli
bcf85fce51 Fix #333 2020-11-03 18:16:55 +08:00
Sunli
03144a47b9 Fix the problem of scalar macro. 2020-11-03 13:50:22 +08:00
Sunli
734b43b613 Fix interface downcasting. #330 2020-10-31 08:58:54 +08:00
Sunli
8d2c8f9bcc Add test for SchemaBuilder::override_description. #327 2020-10-27 20:47:24 +08:00
Sunli
320d9eef50 Add use_type_description attribute for derive macros Object, Scalar and Subscription. 2020-10-26 21:34:05 +08:00
Sunli
33697ea19f Add interface to implement another interface. #322 2020-10-24 09:08:18 +08:00
Sunli
4880c687ca Fix the problem that the Registry::create_dummy_type function may overwrite the keys of the registered type. #316 2020-10-20 19:55:10 +08:00
Sunli
e3d693da28 Add entity lookup support for MergedObject.
Add some GraphQL specification constraints for all derived macros.

Use `Registry::create_dummy_type` to create a merged type.
2020-10-20 11:49:31 +08:00
Sunli
83a0028085 Fix the bug that ʻExtension::prepare_request` cannot get the correct request data through the context.
Add test code for extension.
2020-10-18 11:24:16 +08:00
Koxiaet
a79ee02958 Fix macro hygiene 2020-10-16 20:21:46 +01:00
Koxiaet
79ad5540a1 Make macros hygienic 2020-10-16 11:37:59 +01:00
Koxiaet
12fe7445c7 Replace futures with futures_util 2020-10-16 07:49:22 +01:00
Sunli
4fa4b25ce4 Fix can no longer derive Union for union types with lifetimes. #311 2020-10-15 08:53:17 +08:00
Sunli
f9f60d31ec Configurable case conversion. 2020-10-14 19:16:10 +08:00
Sunli
2d0c192df8 Fix a bug in the validator. 2020-10-14 10:54:46 +08:00
Sunli
715d39b50c 2.0.1 2020-10-14 10:25:41 +08:00
Sunli
6958202238 Update docs 2020-10-13 10:19:30 +08:00
Sunli
c777150dcd Use value! instead of serde_json::json!. 2020-10-12 10:17:05 +08:00
Sunli
e056edbaa0 Add parse_value and from_value funcntions. 2020-10-11 20:24:31 +08:00
Sunli
87ba51fdd0 Some improvements. 2020-10-10 16:28:07 +08:00
AurelienFT
53eab09f19 Rework guard (#296)
Rework guard #293
2020-10-06 17:16:51 +08:00
Sunli
be2b39e486 Restore the original error extension implementation. 2020-10-02 14:56:10 +08:00
Koxiaet
4b20a21783 Fix compilation and tests 2020-09-30 19:40:17 +01:00
Koxiaet
768b666acd Merge master 2020-09-30 18:24:24 +01: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
bff5e97def Add feature to flatten nested GraphQL unions. #286 2020-09-28 11:13:46 +08:00
Sunli
a725594cd1 Add remote attribute for Enum macro. #276 2020-09-27 18:19:11 +08:00
Sunli
7d3eb9b62c Make Object and Subscription macros support #cfg(...) attribute. #281 2020-09-27 10:20:20 +08:00
Sunli
5c293ffdc2 Improve the error message of Tracing extension. 2020-09-26 12:35:28 +08:00
Sunli
5cb507ed90 Add test code for generic object. #274 2020-09-23 14:39:18 +08:00
Sunli
20d240df47 Fix enum strings in query variables are not converted to proper enums. #270 2020-09-20 13:28:18 +08:00
Sunli
e645e9d999 Remove the GQL prefix of all macros. #208 2020-09-18 09:10:24 +08:00
Koxiaet
d52268523f Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master 2020-09-17 19:23:15 +01:00
Koxiaet
890b282dd9 Improve websockets 2020-09-17 19:22:54 +01:00
Sunli
76257403e2 Add support for batch queries. 2020-09-17 19:54:12 +08:00
Sunli
70556af838 Add test for ErrorExtensions. 2020-09-17 08:47:41 +08:00
Sunli
492bba1cdd Move http::websocket::create and http::websocket::create_with_initializer function to http::WebSocketStream. 2020-09-15 20:07:59 +08:00
Sunli
86a6a34aac http::websocket::create function now returns the WebSocketStream type. 2020-09-15 11:19:00 +08:00