Commit Graph

329 Commits

Author SHA1 Message Date
Sunli
7034734cb4 Fix the validator cannot work on Option<Vec<T>>. 2021-11-30 12:03:55 +08:00
Sunli
b7ba6844af #[grapql(validator(list))] no longer applies to max_items and min_items. 2021-11-30 09:40:02 +08:00
Sunli
10646216cc Update docs 2021-11-20 11:16:48 +08:00
Sunli
81e4cc2142 Custom directive 2021-11-20 09:04:46 +08:00
Sunli
26275aaa4b Remove skipped fields from the document before executing the query. 2021-11-18 19:37:10 +08:00
Sunli
94816b84dc 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
723bb10912 Add url, regex and ip validators. 2021-11-17 11:12:52 +08:00
Sunli
d3078e73d0 Remove the ctx parameter of CustomValidator::check. #710 2021-11-17 08:46:13 +08:00
Sunli
2518fd17c6 Add some validators 2021-11-16 16:20:40 +08:00
Sunli
ecc9f3cdc1 Update test 2021-11-16 15:25:48 +08:00
Sunli
13bb603b28 Update error_ext.rs 2021-11-16 11:56:44 +08:00
Sunli
5a3ed87255 Rework guards 2021-11-16 10:22:39 +08:00
Sunli
a7c82d303a Rework validators 3 2021-11-15 18:37:33 +08:00
Sunli
e81bc7a97b Custom validator 2021-11-15 11:08:56 +08:00
Sunli
958b534b77 Rework validators 2 2021-11-15 09:12:13 +08:00
Sunli
8750d8d34b Rework validators 2021-11-14 21:09:14 +08:00
Sunli
08263394a8 Merge branch 'master' into async-graphql-v3 2021-11-13 21:53:50 +08:00
Sunli
0a4ec272b6 Change the signature of the connection::query function to allow the callback to use any type that implements Into<Error>. #671 2021-11-13 21:41:58 +08:00
Sunli
0be420d47b Merge branch 'master' into async-graphql-v3 2021-11-13 09:16:24 +08:00
Sunli
ba66e1406e Fix Federation entity union is empty during schema introspection. #700 2021-11-13 09:08:55 +08:00
Sunli
e6505951af Add test_entity_union 2021-11-13 09:05:29 +08:00
Sunli
732e232a8e Hide types that are not referenced by visible fields. #698 2021-11-12 07:24:04 +08:00
Sunli
dfb6bae04f Update async-graphql-poem 2021-11-12 07:23:05 +08:00
Sunli
20b73e06f4 Move the methods of the Type trait to InputType and OutputType. 2021-11-12 07:23:05 +08:00
Sunli
b75aa6c25b Rework websocket 2021-11-12 07:23:04 +08:00
Sunli
0f1e5a19fd If a GraphQL name conflict is detected when creating schema, it will cause panic. #499 2021-11-08 10:25:31 +08:00
Sunli
53b5701b93 Fix the problem that EmptyMutation may cause when used in MergedObject. #694 2021-11-08 08:45:14 +08:00
Sunli
a26cc65d59 Rework Failure 3 #671 2021-11-07 19:11:43 +08:00
Sunli
490cfec5f5 Rework Failure2 #671 2021-11-05 19:05:49 +08:00
Sunli
d62aca8052 Rework Failure #671 2021-11-04 19:37:22 +08:00
Sunli
63544aab5b Fix tests 2021-11-04 14:54:26 +08:00
Sunli
e898998311 Add Failure type. #671 2021-11-04 14:33:04 +08:00
Sunli
91bb9e81fb Specified By - [GraphQL - October 2021] #677 2021-11-02 20:35:05 +08:00
Miaxos
48b88f6cf8 misc: dbg missed 2021-10-28 15:55:00 +00:00
Miaxos
897ef79b72 feat: add with for object & complex object & update documentation 2021-10-28 12:42:13 +00:00
Miaxos
cd10c2b6dd feat: use with for simple object 2021-10-28 10:22:39 +00:00
Miaxos
2941b7283d feat: add basic coercion for SimpleObject derived arg 2021-10-27 13:37:13 +00:00
Sunli
271946eb0c Respect query object field order. #612 2021-10-26 19:02:15 +08:00
Miaxos
878a1d4d84 feat: add derived for simple object & complex object 2021-10-25 12:23:12 +00:00
Miaxos
3f227217ae feat: add derived on simple objects 2021-10-25 10:56:33 +00:00
Miaxos
02009c401b feat: add derived field for complex object 2021-10-22 13:08:49 +00:00
smihica
7d9de1c0f8 Supported CharsMinLength and CharsMaxLength to count chars 2021-10-14 00:43:14 +09:00
smihica
4c3e5905a7 Revert "Supported multibyte string in StringMinLength and StringMaxLength to count chars, not byte len."
This reverts commit b4116cdcaa.
2021-10-14 00:33:20 +09:00
smihica
b4116cdcaa Supported multibyte string in StringMinLength and StringMaxLength to count chars, not byte len. 2021-10-13 15:16:32 +09:00
Sunli
9e69b40987 Add concrete names support for Object macro. #633 2021-09-24 21:00:17 +08:00
Sunli
d724507458 Implement GraphQL enum to Value conversion. #617 2021-09-17 09:02:09 +08:00
Sunli
243e1d323a Add support for graphql-ws pings. #635 2021-09-16 21:10:39 +08:00
Miaxos
4e86d9f17c fix: add test case for serializing issue 2021-08-18 14:22:17 +00:00
Sunli
c4cfa24e41 Clippy clean 2021-07-31 23:54:16 +08:00
Sunli
28d22dbe32 Add support for the list operator to the input value validator. #579 2021-07-20 15:16:34 +08:00
Sunli
1468cc91bb Implemented OutputType for Bytes. #569 2021-07-18 21:42:39 +08:00
Yin Jifeng
580a593fa0 Allow field visible to support paths 2021-07-18 20:16:39 +08:00
Sunli
d116dc2950 Make Schema::execute return HTTP headers when an error occurs. #572 2021-07-16 07:47:43 +08:00
Sunli
80da563b24 Update guard test 2021-07-15 08:09:29 +08:00
Rodgers
abb59b9e3f Add test for is_valid_with_extensions 2021-07-08 22:06:13 +07:00
Sunli
afecc99085 Add concrete type support for complex object. 2021-07-04 14:05:08 +08:00
Julien Nicoulaud
32d75ec4c9
#550: add unit test for generic Object/Simple/ComplexObject 2021-07-03 18:00:16 +02:00
Sunli
7cb30db2f2 Fix the bug that MergedObject may cause panic. #539 2021-06-21 09:48:19 +08:00
Sunli
f5e3329e86 Implement InputType and OutputType for [T; N] array. 2021-06-17 10:39:27 +08:00
Sunli
19669c11f0 Add serial attribute for MergedObject macro. #539 2021-06-16 15:08:33 +08:00
Sunli
eecf709a2c Add serial attribute for SimpleObject and Object macros. #539 2021-06-15 08:53:26 +08:00
Sunli
8888897c51 Add the operation_name to Extension::execute method. 2021-06-10 10:17:33 +08:00
Sunli
4c98ad2c92 Allow field guards to support paths. #536 2021-06-08 19:42:53 +08:00
Sunli
6dcb15c945 Update test 2021-06-08 19:04:06 +08:00
Sunli
553bf37abe Rework error propagation. #531 2021-06-08 10:05:30 +08:00
Sunli
e86e642d5a Update tests 2021-06-07 14:12:28 +08:00
Sunli
dfe8245894 Add support for returning multiple resolver errors. #531 2021-06-07 14:03:36 +08:00
Sunli
cdd13ea1be Fix the problem that the ComplexObject macro cannot work due to the secret attribute. 2021-04-23 10:25:00 +08:00
Sunli
5831449e07 Add test for drop subscription stream on unsubscribe. 2021-04-13 11:26:55 +08:00
Sunli
5d6b870969 Now when the resolver returns the Result type, E can be all types that implement Into<async_graphql::Error>. 2021-04-09 15:04:01 +08:00
Sunli
22a5e71215 Improve Extensions. 2021-04-05 12:21:02 +08:00
Sunli
7000651b88 Rework Extension 2021-04-04 14:37:41 +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
e991ffb814 Fix internal context missing when there's no connection_init frame. #451 2021-03-24 17:24:12 +08:00
Sunli
bec0fc18a9 Add ComplexObject macro. #355 2021-03-18 10:13:46 +08:00
Sunli
5c644de219 Switch the async runtime used for testing to Tokio. 2021-03-12 12:47:24 +08:00
Taiki Endo
6ddbc52641 Support generics in Subscription types 2021-03-09 22:21:56 +09:00
Sunli
1e6ae23cd8 Add test for Federation entity lookup with DataLoader. 2021-03-06 08:21:44 +08:00
Sunli
69341df41e Moved Variables from async_graphql::context::Variables to
`async_graphql::Variables`.
2021-02-28 09:37:42 +08:00
Sunli
baa837f2ca Allow the deprecation attribute to have no reason. 2021-02-27 11:59:58 +08:00
Sunli
1dd3c7589f Clippy clean 2021-02-26 20:05:09 +08:00
Sunli
14a88cfa19 Add support for Federation nested keys. 2021-02-21 23:06:26 +08:00
Sunli
550ecd9660 Fixed GraphQL over WebSocket Protocol does not support ConnectionError events. #406 2021-02-06 11:02:41 +08:00
Sunli
43a8ad6859 Supports async websocket initializer. #393 2021-01-16 16:37:20 +08:00
Sunli
a0ded06da8 Fix a bug that cause generic InputObject and SimpleObject is incorrect name. #387 2021-01-14 19:20:28 +08:00
Sunli
7bda6333da Add support for generic SimpleObject. #387 2021-01-14 13:16:30 +08:00
Sunli
95e372e0d3 Add Send + Sync constraints for InputType, OutputType and SubscriptionType. 2021-01-14 12:41:59 +08:00
Sunli
ac620c1eea Add support for generic InputObject. #387 2021-01-14 11:27:15 +08:00
Sunli
4d6fd5b539 Clippy clean 2021-01-11 09:01:28 +08:00
Sunli
20e5732525 Implements InputType for Box<T> and Arc<T>. #382 2021-01-10 13:48:18 +08:00
Sunli
c8f5e3de36 Fix #[Object] macro panic with default u32. #361 2020-12-28 18:39:17 +08:00
Aaron Hill
cea22da228
Strip r# prefix when constructing getter ident
When calling `to_string()` on an identifier, the returned string will
have an `r#` prefix if the original identifer was a raw identifier. This
prefix needs to be removed if the identifier is interpolated into
another identifier (e.g. `__some_prefix__r#other_ident`) in order for
the new identifier to be valid.

This issue was previously masked due to the fact that the relevant test
uses `r#i32`. It's possible to use `i32` as a normal (non-raw) ident -
due to a bug in rustc, this means that the user-supplied `r#` prefix
will be lost when calling `to_string()`. This bug will eventually be
fixed, causing `to_string()` to start returning `r#i32` instead of
`i32`.

This commit strips the `r#` prefix (if present) from an identifier
before using it to construct a new identifier. The relevant test is
updated to use `r#match`, which actually requires the `r#` prefix to be
a valid identifier. This causes the test to fail without this patch on
current versions of Rust.
2020-12-20 19:08:22 -05:00
Sunli
ec82e64a39 Improve depth and complex. 2020-12-18 18:56:28 +08:00
Sunli
8979620181 Remove async-channel and async-mutex from dependencies. 2020-12-17 10:05:32 +08:00
Sunli
f59c287ba0 Add the skip attribute to the InputObject fields. 2020-12-15 20:29:59 +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
7796b8c248 Add tests for graphql-ws. 2020-12-04 16:44:48 +08:00
Sunli
30dffdd47f Merge branch 'master' into pr/350 2020-12-04 12:17:23 +08:00
Sunli
c9790087c5 Add websocket subprotocol for actix-web. 2020-12-04 12:13:52 +08:00