Commit Graph

123 Commits

Author SHA1 Message Date
Sunli
8c896f96e1 Remove spin crate from dependencies 2021-04-08 11:41:15 +08:00
Sunli
6aa191fba5 Add secret attribute for arguments, they will not appear in the log. #463 2021-04-07 19:40:19 +08:00
Sunli
7000651b88 Rework Extension 2021-04-04 14:37:41 +08:00
Sunli
39609cf116 Remove SchemaBuilder::override_name method. #437 2021-03-31 16:54:57 +08:00
Sunli
f62843cbd3 Add Request::disable_introspection method. #456 2021-03-30 11:59:57 +08:00
Sunli
cc937b70b5 Rework Extension & TracingExtension & OpenTelemetryExtension 2021-03-26 12:03:10 +08:00
Sunli
aa1e72e68e Add SchemaBuilder::enable_subscription_in_federation method. #449 2021-03-20 17:22:18 +08:00
Sunli
a51abb7284 Add SchemaBuilder::override_name method. #437 2021-03-09 18:07:18 +08:00
Sunli
cd8da606f2 When introspection is disabled, introspection related types are no longer registered. 2021-02-23 12:49:41 +08:00
Sunli
95e372e0d3 Add Send + Sync constraints for InputType, OutputType and SubscriptionType. 2021-01-14 12:41:59 +08:00
Naaman Curtis
b16d7c8aac
update response to correctly carry headers through (#384)
* update response to correctly carry headers through
2021-01-11 08:05:51 +08:00
Sunli
1897859b91 Add Context::set_http_header method. #370 2021-01-10 08:06:48 +08:00
Sunli
ed1dce4985 Add Schema::federation_sdl method. #376 2021-01-06 11:01:13 +08:00
Sunli
a0e05b9c92 Add dataloader 2020-12-21 13:33:36 +08:00
Sunli
bbb7124616 Add Analyzer extension. 2020-12-18 23:58:03 +08:00
Sunli
ec82e64a39 Improve depth and complex. 2020-12-18 18:56:28 +08:00
Sunli
e29b7a3627 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
5097832539 Fix #327. 2020-10-28 09:39:19 +08:00
Sunli
b124382e9c Add SchemaBuilder::override_description function. 2020-10-27 10:06:10 +08:00
Sunli
c999dd26dd Fix typo 2020-10-22 10:11:47 +08:00
Sunli
776aadf169 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
7510741311 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
db312a372d Replace futures with futures_util 2020-10-16 07:49:22 +01:00
Koxiaet
4e562a86a7 Avoid locking extensions mutex when possible 2020-10-16 06:52:52 +01:00
Koxiaet
a48953899c Remove itertools dependency 2020-10-16 06:37:48 +01:00
Sunli
985ee939d4 Add Schema::names function. 2020-10-15 19:36:54 +08:00
Koxiaet
d34ac0ba08 Make imports consistent 2020-10-15 07:38:10 +01:00
Sunli
6dd9483762 Improve performance 2020-10-12 14:49:32 +08:00
Sunli
10cd868f4c Some improvements. 2020-10-10 16:28:07 +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
fd4c2b193b Added Apollo persisted queries extension. #280 2020-09-30 11:37:12 +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
4bbb30b2ae Update schema.rs 2020-09-27 19:13:12 +08:00
Sunli
e9efad4479 Fix the problem when generating Federation SDL. #283 2020-09-27 18:49:04 +08:00
Sunli
39f8a4fa17 Invoke extensions for execute_schema. 2020-09-26 15:52:59 +08:00
Sunli
e3125b2d2d Add Schema::sdl method. #191 2020-09-23 14:14:22 +08:00
Koxiaet
203ea4ad64 Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master 2020-09-22 20:03:33 +01:00
Koxiaet
0880be3e0b Move some validations to parser
This commit moves the single anonymous and duplicated operation name
validation rules into the parser, allowing for a nicer format to be
exposed by it. It also adds better error messages to the parser.
2020-09-22 19:59:48 +01:00
Sunli
fa10a55745 Add Request::extension method. #271 2020-09-21 15:53:07 +08:00
Koxiaet
5cf527aeef Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master 2020-09-17 19:23:15 +01:00
Koxiaet
88be6bca61 Improve websockets 2020-09-17 19:22:54 +01:00
Sunli
acc1a6f515 Add support for batch queries. 2020-09-17 19:54:12 +08:00
Sunli
d67a511a07 2.0.0-alpha.5 2020-09-14 09:46:22 +08:00
Koxiaet
d404e756bc Rework subscriptions
The main change in this commit is changing the return type of
SubscriptionType::create_stream from
Future<Result<Stream<Result<Response>>>> to just Stream<Result<Json>>. I
also allowed the returned stream to borrow from self and context.
2020-09-13 18:52:36 +01:00
Koxiaet
8796c5e1a7 Replace http::GQLRequest with Request 2020-09-12 17:07:46 +01:00