Commit Graph

44 Commits

Author SHA1 Message Date
Sunli
0eefc3932b Fixes #1004 2022-08-05 14:50:29 +08:00
Sunli
69b09f2636 Fix impossible to specify both name and input_name. #987 2022-07-18 16:34:57 +08:00
Sunli
88ba75ec70 Rework connection types 2022-04-19 19:18:06 +08:00
Douman
b0933b3475 Add process_with to methods 2022-04-06 18:25:07 +09:00
Douman
ca1f9045cc Introduce process_with for input object 2022-04-05 11:31:11 +09:00
Sunli
a62eb6f699 Panics when the same Rust type has the same name. #880 2022-03-30 20:54:49 +08:00
Sunli
665f464448 Fixed recursive generic input objects failing to compile. #859 2022-03-14 09:46:06 +08:00
Sunli
df3312363e Add OneOfObject macro to support for oneof input object. #766 2022-02-17 19:35:55 +08:00
Sunli
334b6efe99 Add skip_input attribute to InputObject macro, skip_output attribute to SimpleObject macro. #797 2022-01-26 17:54:24 +08:00
Sunli
559bbedd3e Allowed use validators on wrapper types, for example: Option<T>, MaybeUnefined<T>.
Remove `OutputJson` because `Json` can replace it.
2021-11-18 15:43:12 +08:00
Sunli
af25734697 Remove the ctx parameter of CustomValidator::check. #710 2021-11-17 08:46:13 +08:00
Sunli
613bbc5b91 Custom validator 2021-11-15 11:08:56 +08:00
Sunli
dd55421ede Rework validators 2 2021-11-15 09:12:13 +08:00
Sunli
eb022a0cca Rework validators 2021-11-14 21:09:14 +08:00
Sunli
0e9e087691 Move the methods of the Type trait to InputType and OutputType. 2021-11-12 07:23:05 +08:00
Sunli
b359b62976 If a GraphQL name conflict is detected when creating schema, it will cause panic. #499 2021-11-08 10:25:31 +08:00
Sunli
9b5149ee23 Respect query object field order. #612 2021-10-26 19:02:15 +08:00
Sunli
1e57b6b33a If InputObject contains an unnamed field, the correct error message will be given. #498 2021-05-06 16:44:36 +08:00
Sunli
a9ac598e2e Add secret attribute for arguments, they will not appear in the log. #463 2021-04-07 19:40:19 +08:00
Sunli
5c66a9cdda Add support for Federation nested keys. 2021-02-21 23:06:26 +08:00
Sunli
9c6fe67a23 Fix a bug that cause generic InputObject and SimpleObject is incorrect name. #387 2021-01-14 19:20:28 +08:00
Sunli
74657c6242 Add support for generic InputObject. #387 2021-01-14 11:27:15 +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
5c39d0197d Rename InputValueType to InputType and OutputValueType to OutputType. 2020-12-11 15:37:50 +08:00
Sunli
e1be5d5537 Fix typo 2020-10-22 10:11:47 +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
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
Sunli
8c933dbc36 Make imports consistent 2020-10-16 10:45:48 +08:00
Sunli
f9f60d31ec Configurable case conversion. 2020-10-14 19:16:10 +08:00
Sunli
a1e57eb4a8 All merged objects will no longer be removed. #308 2020-10-12 11:04:01 +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
Sunli
22f7e09537 Fix typo. #297 2020-10-04 07:49:56 +08:00
Sunli
97f0b0d419 Merge branch 'master' into rework-errors 2020-10-01 09:07:19 +08:00
Koxiaet
768b666acd Merge master 2020-09-30 18:24:24 +01:00
Sunli
35f886a7f8 Improve trait for GraphQL types. 2020-09-30 07:45:48 +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
e60864a18d Rework async-graphql-derive. #288 2020-09-29 16:06:10 +08:00
Sunli
f4c4955fc4 Remove useless code. 2020-09-28 09:56:15 +08:00
Sunli
0d6771a199 Add some type detection to make the defined schema conform to the GraphQL specification. #282 2020-09-27 15:35:05 +08:00
Sunli
1e430b9c11 Remove InputObjectType and add InputValueType/OutputValueType to docs 2020-09-15 09:31:55 +08:00
Sunli
668b1fea94 Remove prefixes and add integrations subdirectory #259 2020-09-09 10:08:17 +08:00