Commit Graph

36 Commits

Author SHA1 Message Date
Sunli 03f6ed4ba2 Rename InputValueType to InputType and OutputValueType to OutputType. 2020-12-11 15:37:50 +08:00
Sunli ad3f576fe9 Update upload.rs 2020-11-30 13:47:00 +08:00
Koxiaet 68381cfc65 Make macros hygienic 2020-10-16 11:37:59 +01:00
Koxiaet db312a372d Replace futures with futures_util 2020-10-16 07:49:22 +01:00
Koxiaet d34ac0ba08 Make imports consistent 2020-10-15 07:38:10 +01:00
Sunli 10cd868f4c Some improvements. 2020-10-10 16:28:07 +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 b0690cae8b Fix compiling without features 2020-09-18 15:14:40 +08:00
Sunli c98b269e50 Add Upload::into_async_read with blocking 2020-09-18 14:32:00 +08:00
Sunli 322e296a24 Remove the GQL prefix of all macros. #208 2020-09-18 09:10:24 +08:00
Sunli de3f0937b0 Some improvements. 2020-09-17 11:22:09 +08:00
Sunli f530d01bf4 Remove all attribute macros that can be replaced by derive. 2020-09-13 11:41:15 +08:00
Koxiaet b3093e92d4 Fix Tide tests 2020-09-08 11:07:32 +01:00
Koxiaet 3bf5f3a16c Rustfmt 2020-09-06 07:16:36 +01:00
Koxiaet e3e58d261d Rewrite async-graphql-parser 2020-09-06 06:38:31 +01:00
William Myers 53e5467eb4
Add docs about into_read being blocking
Addresses #151
2020-06-07 20:44:01 -06:00
Sunli 18dacbdf17
Add MaybeUndefined type (#123)
* Add MaybeUndefined type
2020-05-28 15:00:55 +08:00
Sunli a92a619345 Implement a type-safe default value definition for InputValue. #111 2020-05-26 20:43:53 +08:00
Sunli 9184c999ae Modify some type names (internal types) 2020-05-15 10:08:37 +08:00
sunli 83579077d9 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 b521e6c64d It not finished yet. 2020-05-11 17:13:50 +08:00
sunli 6d7d64866b The error reason can be returned when the input value is parsed incorrectly. #70 2020-05-10 18:27:46 +08:00
sunli aefe448ede Move project to async-graphql 2020-04-28 15:41:31 +08:00
sunli 1bc97de889 fix #33 2020-04-27 12:57:52 +08:00
nicolaiunrein 3548d5fa83
Fix url linking from `Upload` to example. 2020-04-20 07:59:10 +02:00
sunli 4d6b484150 v1.8.1 2020-04-11 17:40:29 +08:00
sunli b880a937ce Add GQLHttpRequest and IntoQueryBuilder trait 2020-04-11 17:36:05 +08:00
sunli 0bd58abd86 Fixed panic when uploading binary file 2020-04-03 09:27:22 +08:00
nicolaiunrein 0da2f900a1
Update upload.rs 2020-03-30 16:47:17 +02:00
nicolaiunrein 9eaf445cc2
Update upload.rs 2020-03-30 16:36:27 +02:00
nicolaiunrein 6944a542bb
Update upload.rs 2020-03-30 16:31:38 +02:00
Nicolai Unrein 0d3fb8d1de add documentation to upload 2020-03-30 16:25:35 +02:00
sunli 2b2be34d4d Clippy cleanup 2020-03-21 09:32:13 +08:00
sunli d95c0f23b8 v1.3.2 2020-03-20 11:56:08 +08:00
sunli ac044d6d30 add GraphQL Cursor Connections 2020-03-19 17:20:12 +08:00
sunli f78a172241 Add support for multipart request 2020-03-14 11:46:20 +08:00