Commit Graph

340 Commits

Author SHA1 Message Date
Sunli 76257403e2 Add support for batch queries. 2020-09-17 19:54:12 +08:00
Sunli 70556af838 Add test for ErrorExtensions. 2020-09-17 08:47:41 +08:00
Sunli 492bba1cdd Move http::websocket::create and http::websocket::create_with_initializer function to http::WebSocketStream. 2020-09-15 20:07:59 +08:00
Sunli 86a6a34aac http::websocket::create function now returns the WebSocketStream type. 2020-09-15 11:19:00 +08:00
Sunli 42817a3aa6 Implement Type for more stdlib collection types #189
Implement InputValueType/OutputValueType for HashSet<T>/BTreeSet<T>/VecDeque<T>/LinkedList<T>
Implement ScalarType for char/NonZero*/HashMap<String,T>/BTreeMap<String, T>
2020-09-14 20:06:44 +08:00
Sunli 5bb705bdf3 2.0.0-alpha.5 2020-09-14 09:46:22 +08:00
Koxiaet 6e628031bf 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 367076cd66 Remove SimpleBroker 2020-09-13 10:47:28 +01:00
Koxiaet 9796364348 Move websockets to http module and fix doc tests 2020-09-13 07:40:34 +01:00
Sunli 24b80d52d3 Remove all attribute macros that can be replaced by derive. 2020-09-13 11:41:15 +08:00
Koxiaet dcc7d1be14 Replace http::GQLRequest with Request 2020-09-12 17:07:46 +01:00
Koxiaet 35e74a4e17 Create resolver_utils 2020-09-12 10:29:52 +01:00
Sunli a4fdf6a38a Re-enable the test on websocket. 2020-09-11 16:41:56 +08:00
Sunli c129079f69 Fix tests 2020-09-11 16:05:21 +08:00
Sunli 049b652dd6 Add transports::websocket module. 2020-09-11 15:54:56 +08:00
Sunli 35f17a389c Remove unnecessary Result on Schema::execute_stream function. 2020-09-11 10:47:55 +08:00
Sunli 91c75ced2a Make all tests passed (async-graphql). 2020-09-10 19:35:48 +08:00
Sunli f3c0d86f12 Continue to refactor. 2020-09-10 16:39:43 +08:00
Koxiaet 04c898ef01 Rustfmt 2020-09-08 09:30:29 +01:00
Koxiaet 47259548c4 Support service parsing in async-graphql-parser
- Instead of adding a separate module `schema` like there was before,
since service parsing and executable parsing have a fair amount of
overlap I put them as two submodules `executable` and `service` in both
`parse` and `types`. Also, the grammar is unified under one `.pest`
file.
- Added const equivalents to `Value`, `Directive` etc
- Change the reexport `async_graphql::Value` from
`async_graphql_parser::types::Value` to
`async_graphql_parser::types::ConstValue` since in 99% of cases in this library
a const value is wanted instead of a value.
- Added consistent usage of executable/service instead of the ambiguous
query/schema.
- Some of the tests actually had invalid GraphQL so the new more correct
grammar made them fail, that was fixed.
- Added a `Name` newtype to refer to GraphQL names
(`[A-Za-z_][A-Za-z_0-9]*`) since they are used so frequently.
2020-09-08 09:21:27 +01:00
Koxiaet 1c26ff124f Merge branch 'master' into master 2020-09-06 07:20:18 +01:00
Koxiaet c055736101 Rustfmt 2020-09-06 07:16:36 +01:00
Koxiaet 81d85c2535 Rewrite async-graphql-parser 2020-09-06 06:38:31 +01:00
Sunli b4997e4b27 Add test for multiple flatten attribute of InputObject. 2020-09-04 14:14:48 +08:00
Sunli 78a1a33cda Add flatten type field support for input objects. #255 2020-09-03 20:00:33 +08: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 6a38057a22 Implements Default for Schema. 2020-08-28 14:19:35 +08:00
Sunli c35eecd90d Merge subscriptions #243 2020-08-27 15:35:48 +08:00
Sunli a0148675c8 Add support for mut field args. 2020-08-17 21:48:53 +08:00
Sunli 4e8bd65b34 Fix send data with 'complete' WebSocket message. #238 2020-08-14 15:21:10 +08:00
Sunli caedc4d783 Update test for MergedObject. 2020-08-11 09:37:33 +08:00
Sunli 2a62c56104 Add derive macro GQLMergeObject. #231 2020-08-10 14:11:46 +08:00
Sunli b0403f4e99 Add Default impl for MergedObject. #231 2020-08-10 10:47:30 +08:00
Sunli 4b6bb38e83 Add MergedObject type. #231 2020-08-09 15:03:10 +08:00
Sunli 47174966fb Add directive @ifdef 2020-08-06 14:52:54 +08:00
Sunli aa3293b65c Add support for query execution over websocket. 2020-07-31 11:30:57 +08:00
Sunli 2cf350a5c8 Removes code about streaming requests. 2020-07-31 10:10:03 +08:00
Sunli 2dc61013be Replace Value::Int and Value::Float with Value::Number. 2020-07-29 09:42:52 +08:00
Sunli 909ae5e64d Fix input validator is ignored when using variable #207 2020-07-11 10:05:30 +08:00
Sunli 2dde8b4aa6 Add OutputJson type #203 2020-07-08 14:44:57 +08:00
Blaine Bublitz c48f126fcd Use FieldResult for data(), add data_unchecked() for panic 2020-07-06 17:39:53 -07:00
Sunli d03e939394 Correct handling of raw identifiers #195 2020-07-02 10:25:20 +08:00
Blaine Bublitz 0fde868459 Fix issue with unwrapping derive attributes 2020-06-25 13:54:13 -07:00
Sunli eb7a72aac6 Remove `ref` attribute for SimpleObject fields, and add `owned` attribute. 2020-06-23 14:42:57 +08:00
Sunli 665b337bf2 Remove all datasource-related code and update the documentation. 2020-06-15 14:17:19 +08:00
Sunli 1b8de3b433 Remove connection::DataSource 2020-06-15 12:06:15 +08:00
Bryan Burgers e21f2e6316 Allow vars to be missing when def is nullable
Allow variables to be missing when the associated variable definition is
nullable (in which case we use `null` as the default).

This fixes queries like

```graphql
query Test($var: Int) {
    test(var: $var)
}
```

```json
{}
```

which appear to be allowed according to the GraphQL spec.
2020-06-11 10:00:47 -05:00
Sunli 82eefd67fd Add GQLEnum, GQLInputObject, GQLSimpleObject macros. #164
use `proc_macro_derive` to solve the problem that Enum, InputObject, and SimpleObject do not support the #cfg attribute.
2020-06-11 11:23:23 +08:00
Sunli edec696610 Add tests for feature attribute 2020-06-06 11:49:29 +08:00
Sunli 96f7d38c8a Update PostGuard tests 2020-06-03 16:56:15 +08:00
Sunli 746544412b Add PostGuard. #129 2020-06-03 14:50:06 +08:00
Sunli 2452a44484 Add connection::query function 2020-06-02 17:43:13 +08:00
Kevin Schoonover 9b114cf616 Add input validator tests + fix clippy errors 2020-06-01 16:42:13 -05:00
Sunli 267620d08e Fix incorrect variable substitution. #126 2020-05-31 11:54:07 +08:00
Sunli 9a97ac443f Update connection tests 2020-05-29 11:12:43 +08:00
Sunli 6cc92458e1 Add Connection::try_append and Connection::try_append_stream 2020-05-29 09:24:31 +08:00
Sunli 43c8daa132 Add MaybeUndefined type (#123)
* Add MaybeUndefined type
2020-05-28 15:00:55 +08:00
Sunli 0c15370bcd Fix the problem that async-graphql cannot be compiled and passed in rust nightly-2020-05-25. #122 2020-05-28 10:26:07 +08:00
Sunli 76ff909ccd New data source (#105)
* New data source
2020-05-28 08:02:00 +08:00
Sunli 41cba4d6fb Fixed a bug in fragment query. #114 2020-05-27 15:23:53 +08:00
Sunli 5e18c69dd6 Update input_validators.rs 2020-05-27 10:25:59 +08:00
Sunli b16fc7b9b9 Add the method parameter to the interface field. #112 2020-05-27 10:25:23 +08:00
Sunli 451f0c27f0 Compilation trouble with StringMinLength validator. #113 2020-05-27 09:42:58 +08:00
Sunli bb97e86410 Add some tests for default value 2020-05-27 09:27:59 +08:00
Sunli a9d3ac9cf8 Implement a type-safe default value definition for InputValue. #111 2020-05-26 20:43:53 +08:00
Samuel Hurel f9249e403f Add proper count for Stream DataSource impl 2020-05-21 14:02:21 +02:00
Samuel Hurel d58fd6e942 Remove StreamDataSource wrapper 2020-05-21 13:10:36 +02:00
Samuel Hurel 1f4b732615 Fix tests & impl From<Stream> for StreamDataSource 2020-05-21 10:22:36 +02:00
Samuel Hurel 3aac2160e0 Remove StreamDataSource mapping closure 2020-05-21 09:55:49 +02:00
Samuel Hurel 02de780921 Stream connection 2020-05-21 09:40:42 +02:00
Sunli bcd39f4df8 Remove Clone bound for Deferred and Streamed 2020-05-21 15:38:26 +08:00
Sunli 24af597f30 Add StreamResponse type 2020-05-21 11:36:44 +08:00
Sunli 326fac2799 Add @stream directive 2020-05-21 10:12:54 +08:00
sunli 374023748d Add @defer support for actix-web 2020-05-20 20:10:40 +08:00
sunli 6f924efcf4 Add defer tests 2020-05-20 13:42:55 +08:00
Sunli 75bfba057a Add Deferred type and @defer directive. #51 2020-05-19 20:53:29 +08:00
Sunli d00e3e8c25 The scalar name and description attributes are placed on the process macro attributes. #97 2020-05-19 13:27:01 +08:00
Sunli 85c54762bf Sort __Schema.types and __Schema.directives by name. #93 2020-05-18 11:37:05 +08:00
Sunli 26e737014e Support multiple lines of rustdoc as a type description. 2020-05-18 10:09:09 +08:00
krevativ 873f6d3d11 Format introspection tests 2020-05-17 20:59:21 +02:00
krevativ b12fed4b56 Delete old test_introspection.rs file 2020-05-17 20:57:55 +02:00
krevativ ee32ea5455 Add introspection tests 2020-05-17 20:55:40 +02:00
Sunli 693ffda56a Merge pull request #75 from phated/interface-enums
Change interfaces & unions to require enums
2020-05-11 13:44:19 +08:00
Blaine Bublitz b7bc7fea12 Change Unions to enums instead of structs 2020-05-10 21:27:30 -07:00
Sunli 8a84455b0a Create a boilerplate test code for introspection. #66 2020-05-11 12:24:16 +08:00
Blaine Bublitz 6f70924967 Fix tests 2020-05-10 20:25:49 -07: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 f24c6fceff Add ability to forward field arguments to guard #59 2020-05-09 18:34:57 +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 d7ea05ab14 Add tests to limit complexity and depth. 2020-05-05 13:46:56 +08:00
sunli 9b917e19b3 Modify the location of the Guard call. 2020-05-05 13:02:24 +08:00
sunli 40e78a02b7 Update default_value.rs 2020-05-04 13:26:13 +08:00
sunli 8abe70ffd5 Create default_value.rs 2020-05-04 10:49:35 +08:00
sunli f3697e6a1a Implement OutputType for FieldResult 2020-05-03 22:32:37 +08:00
sunli 2c53df7bb5 Stops when an error occurs to the subscription stream. 2020-05-03 21:21:54 +08:00
sunli 220cd1e775 Report subscription stream errors to the client. 2020-05-03 16:02:46 +08:00
sunli d7df065528 Fixed a bug that caused the subscription request to fail to receive any messages. #45 2020-05-03 10:06:17 +08:00
sunli c9fe0e9393 Add some test 2020-05-03 09:12:14 +08:00
sunli 81e2143015 v1.10.1 2020-05-02 11:03:04 +08:00
sunli 331e65a72b Add field guard 2020-05-02 07:57:34 +08:00
sunli 4659da9c30 fix #33 2020-04-27 12:57:52 +08:00
sunli a4a1db4836 Update subscription test 2020-04-23 22:29:38 +08:00
sunli 4247cbcb47 v1.9.17 2020-04-23 18:11:03 +08:00
sunli d564ce27f1 Websocket transport creates context data from the connect_init.payload property 2020-04-23 14:52:22 +08:00
sunli aac2710c99 The subscriptions field supports a return value of type FieldResult 2020-04-23 11:26:36 +08:00
sunli a4781523fb v1.9.11
Add context data for subscription
2020-04-23 10:26:16 +08:00
sunli 6da2e3a528 Add some tests 2020-04-22 21:31:44 +08:00
sunli d76decdc16 Clippy cleanup 2020-04-22 15:03:41 +08:00
sunli 279244d106 Fix interface resolver bug 2020-04-22 14:59:14 +08:00
Sunli 7e481b5bde Merge branch 'master' into interface-test 2020-04-22 13:39:07 +08:00
sunli 00513ffb02 v1.9.9 2020-04-22 13:30:41 +08:00
Blaine Bublitz 0c015bd418 Add failing interface test 2020-04-21 22:18:36 -07:00
sunli 5b7ef8b8b5 Update interface.rs 2020-04-21 20:54:38 +08:00
sunli c11ed53c48 Add SchemaBuilder::register_type method 2020-04-21 20:47:48 +08:00
sunli 48708e9527 Update interface.rs 2020-04-21 15:40:31 +08:00
sunli 041eb7b1b7 v1.9.7
Add a `ref` attribute to the field attribute of `SimpleObject`.
2020-04-21 15:40:19 +08:00
sunli 64e68c949b v1.9.6
Add SimpleObject support to Interface
2020-04-21 15:27:43 +08:00
sunli affacd81d0 v1.9.4 2020-04-20 14:37:28 +08:00
sunli 0b9d5ee071 The int64 scalar serializes to a string 2020-04-19 10:17:47 +08:00
sunli 09d5e5f489 v1.9.0 2020-04-14 09:53:17 +08:00
sunli 86bdb422b1 Add federation support 2020-04-09 22:03:09 +08:00
sunli 03e1604f0b Fixed #attribute not working on the InputObject fields. 2020-04-08 12:02:48 +08:00
sunli a813ce72a3 v1.7.8 2020-04-08 09:05:54 +08:00
sunli 5c710ff744 Add SimpleBroker 2020-04-07 14:30:46 +08:00
sunli ed85c85bf4 Add subscription test 2020-04-06 18:30:38 +08:00
sunli 185e1fb8e6 Add some test, modified from juniper 2020-04-05 16:00:26 +08:00
sunli 197eed8629 Add mutation resolver 2020-04-03 22:19:15 +08:00
sunli 506e82895f Add Schema::execute 2020-04-02 12:53:53 +08:00
sunli b373e1397d remove `PreparedQuery` 2020-04-01 16:53:49 +08:00
sunli bc0d6603c1 v1.6.0 2020-03-26 11:34:28 +08:00
sunli b0369860dd v1.5.1 2020-03-25 11:39:28 +08:00
sunli 0769513c8b v1.5.0
Improve performance
2020-03-24 18:54:22 +08:00
sunli 724cb21258 add GraphQL Cursor Connections 2020-03-19 17:20:12 +08:00
sunli 60b0282a89 Support subscription 2020-03-17 17:26:59 +08:00
sunli e0471ddc10 auto rename to camelcase 2020-03-09 20:00:57 +08:00
sunli ce3d4cbc33 fix some bug 2020-03-09 09:33:36 +08:00
sunli 5ab4f73c76 v0.9.4 2020-03-07 20:54:03 +08:00
sunli 25a93b6976 v0.9.2 2020-03-07 12:40:04 +08:00