Commit Graph

65 Commits

Author SHA1 Message Date
Sunli
f8021c0fb5 Add support for returning multiple resolver errors. #531 2021-06-07 14:03:36 +08:00
Sunli
1c32a8afcb Now all features are not activated by default. 2021-03-22 10:39:17 +08:00
Sunli
5f2e0ae50d Clippy clean 2021-01-11 09:01:28 +08:00
Sunli
099415fd42 Implements InputType for Box<T> and Arc<T>. #382 2021-01-10 13:48:18 +08:00
Sunli
5c39d0197d Rename InputValueType to InputType and OutputValueType to OutputType. 2020-12-11 15:37:50 +08:00
Koxiaet
6d5233f690 Don't duplicate type names in parsing error message 2020-11-07 06:05:59 +00: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
Sunli
3bd3de3d09 Derive Serialize for Request and Deserialize for Response. 2020-10-23 08:26:48 +08:00
Koxiaet
75be2c5d7f Require JSON content-type 2020-10-15 18:30:16 +01:00
Sunli
cac3d4c074 Fix a small bug. 2020-10-15 16:45:33 +08: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
Aurelien Foucault
17a85c451a Add eq for errors 2020-10-08 15:32:37 +02:00
Sunli
22f7e09537 Fix typo. #297 2020-10-04 07:49:56 +08:00
Sunli
be2b39e486 Restore the original error extension implementation. 2020-10-02 14:56:10 +08:00
Sunli
6afac75ccf Merge branch 'master' into rework-errors 2020-10-01 09:39:47 +08:00
Sunli
a95a532857 Added Apollo persisted queries extension. #280 2020-09-30 11:37:12 +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
5c293ffdc2 Improve the error message of Tracing extension. 2020-09-26 12:35:28 +08:00
Koxiaet
49462cf05f 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
Koxiaet
07d2204773 Remove code duplication for batch requests 2020-09-17 19:43:03 +01:00
Sunli
5d705afeb4 Update docs 2020-09-17 09:03:36 +08:00
Koxiaet
e2f53cc30f Document features 2020-09-15 19:32:13 +01:00
Koxiaet
a3ad1aac30 Remove and feature-gate dependencies 2020-09-14 19:38:41 +01:00
Sunli
f3c0d86f12 Continue to refactor. 2020-09-10 16:39:43 +08:00
Koxiaet
81d85c2535 Rewrite async-graphql-parser 2020-09-06 06:38:31 +01:00
Sunli
769bffcbf2 Fix the test code and add docs. 2020-09-01 09:10:12 +08:00
Koxiaet
02f7a5fbbc Remove dependency on serde_derive, satisfy Clippy, improve docs 2020-08-31 19:18:02 +01:00
Sunli
4d3851e1b5 Replace log crate with xlog. 2020-07-15 18:05:24 +08:00
Kevin Schoonover
9b114cf616 Add input validator tests + fix clippy errors 2020-06-01 16:42:13 -05:00
sunli
6f924efcf4 Add defer tests 2020-05-20 13:42:55 +08:00
Sunli
c4ef89e00c Upgrade multer to 1.1.1 2020-05-18 09:32:55 +08:00
sunli
2a63fe1b54 Replace multipart parser with multer. 2020-05-17 16:26:36 +08:00
sunli
8e9aff105e Support Upload Stream #15
I think the previous implementation is not elegant enough, the `QueryBuilder::set_files_holder` function looks disgusting, so I refactored it.
By the way, the performance of parsing InputValue has been optimized, and unnecessary clones have been removed.
2020-05-11 21:47:24 +08:00
sunli
728989209f The error reason can be returned when the input value is parsed incorrectly. #70 2020-05-10 18:27:46 +08:00
sunli
7f7e708614 Move the parser to async-graphql-parser crate. 2020-05-09 22:02:55 +08:00
sunli
dc7c8d5280 Merge branch 'parser'
Implement a new GraphQL query parser and remove the dependency on graphql-parser.
2020-05-09 17:55:04 +08:00
sunli
331e65a72b Add field guard 2020-05-02 07:57:34 +08:00
sunli
44bd920ad2 Update error.rs 2020-04-22 19:09:59 +08:00
sunli
279244d106 Fix interface resolver bug 2020-04-22 14:59:14 +08:00
sunli
98cdfd4c42 v1.9.5 2020-04-21 12:13:14 +08:00
sunli
09d5e5f489 v1.9.0 2020-04-14 09:53:17 +08:00
sunli
0b6bfd4c33 Add GQLHttpRequest and IntoQueryBuilder trait 2020-04-11 17:36:05 +08:00
sunli
86bdb422b1 Add federation support 2020-04-09 22:03:09 +08:00
sunli
269f0f0d61 Update error.rs 2020-04-02 14:40:00 +02:00
sunli
cb0ca21a3d Extract line and column from ParseError 2020-04-02 12:37:04 +08:00
sunli
14860d9b88 Reimplement the error type and remove the dependency on the anyhow::Error 2020-04-02 10:21:04 +08:00
Nicolai Unrein
5157d95efc ExtendedError and ResultExt inital draft 2020-03-29 16:31:45 +02:00
sunli
bf7332378c v1.5.2 2020-03-25 15:07:16 +08:00
sunli
99f4184f83 Clippy cleanup 2020-03-21 09:32:13 +08:00