Commit Graph

130 Commits

Author SHA1 Message Date
Sunli
322e296a24 Remove the GQL prefix of all macros. #208 2020-09-18 09:10:24 +08:00
Koxiaet
d404e756bc 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
42c3cfc17c Improve lookahead 2020-09-13 08:02:14 +01:00
Sunli
f530d01bf4 Remove all attribute macros that can be replaced by derive. 2020-09-13 11:41:15 +08:00
Koxiaet
cffed09c78 Remove Deref for ContextBase 2020-09-12 17:42:15 +01:00
Koxiaet
8796c5e1a7 Replace http::GQLRequest with Request 2020-09-12 17:07:46 +01:00
Sunli
31f4dcb2f2 Merge branch 'master' of https://github.com/async-graphql/async-graphql 2020-09-09 18:42:58 +08:00
Sunli
0d3a0f6949 Add context to ResolveInfo. #260 2020-09-09 18:42:10 +08:00
Koxiaet
7cd823ba04
Merge branch 'master' into master 2020-09-08 09:48:01 +01:00
Koxiaet
c42aa55625 Rustfmt 2020-09-08 09:30:29 +01:00
Koxiaet
ed5acdcf18 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
Sunli
5f14325ef5 Remove historical code that is no longer used. 2020-09-07 18:53:03 +08: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
Koxiaet
945cd72869 Remove dependency on serde_derive, satisfy Clippy, improve docs 2020-08-31 19:18:02 +01:00
Sunli
a193a8e51a Add directive @ifdef 2020-08-06 14:52:54 +08:00
Sunli
3d7594bac1 Removes code about streaming requests. 2020-07-31 10:10:03 +08:00
Sunli
c7c4de94ed Replace log crate with xlog. 2020-07-15 18:05:24 +08:00
Blaine Bublitz
6ed3909a9a Use FieldResult for data(), add data_unchecked() for panic 2020-07-06 17:39:53 -07:00
Sunli
c8409e1a00 Remove ref attribute for SimpleObject fields, and add owned attribute. 2020-06-23 14:42:57 +08:00
Sunli
09a6eb4944 Extension::Logger now provides more comprehensive error information. 2020-06-13 22:14:47 +08:00
Bryan Burgers
81c7683e4d 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
d932d30209 Fix incorrect variable substitution. #126 2020-05-31 11:54:07 +08: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
3b7ecfe9c2 Update doc for Context::data 2020-05-22 14:02:28 +08:00
Sunli
d719461ae5 Add logger extension 2020-05-22 11:58:49 +08:00
Sunli
4868cf242b Add @stream directive 2020-05-21 10:12:54 +08:00
sunli
e949cb441c Add defer tests 2020-05-20 13:42:55 +08:00
Sunli
d300e27fa2 Add Deferred type and @defer directive. #51 2020-05-19 20:53:29 +08:00
sunli
1c78341ce8 Remove some unsafe code 2020-05-16 21:14:26 +08:00
Sunli
14312ba472 Rename async_graphql_parser::ast to async_graphql_parser::query 2020-05-15 10:38:48 +08:00
sunli
ad8ba68d44 Add Context::look_ahead 2020-05-14 22:13:28 +08:00
Sunli
c4b619b98c Add Context::position 2020-05-14 17:35:25 +08:00
sunli
01b2ce8e18 Improve GraphQL query parser performance. #76 2020-05-12 16:27:06 +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
6d7d64866b The error reason can be returned when the input value is parsed incorrectly. #70 2020-05-10 18:27:46 +08:00
sunli
f7d308be8a Improve parser performance. 2020-05-10 10:59:51 +08:00
sunli
917783038a Remove the disgusting functions json_value_to_gql_value and gql_value_to_json_value.😂 2020-05-09 22:16:39 +08:00
sunli
311859e12a 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
495df5a9ab Add tracing extension 2020-04-28 15:01:19 +08:00
sunli
235b49bb7d Update context.rs 2020-04-24 10:05:41 +08:00
sunli
9d294708e1 Use FnvHashMap for Data 2020-04-23 21:36:04 +08:00
sunli
998e9b7b85 Websocket transport creates context data from the connect_init.payload property 2020-04-23 14:52:22 +08:00
sunli
09624cab24 v1.9.11
Add context data for subscription
2020-04-23 10:26:16 +08:00
sunli
b880a937ce Add GQLHttpRequest and IntoQueryBuilder trait 2020-04-11 17:36:05 +08:00
sunli
631de52400 The subscription field now returns a stream 2020-04-06 13:49:39 +08:00
sunli
0bd58abd86 Fixed panic when uploading binary file 2020-04-03 09:27:22 +08:00
sunli
10105b8a09 Reimplement the error type and remove the dependency on the anyhow::Error 2020-04-02 10:21:04 +08:00
sunli
01ec88abf5 remove PreparedQuery 2020-04-01 16:53:49 +08:00
sunli
3938c2f80c v1.6.8
Add context data support
2020-03-31 11:19:18 +08:00
sunli
9b538cd85b Add validation for the InputObject field 2020-03-30 10:45:41 +08:00
sunli
25210e0e15 v1.6.2 2020-03-26 18:30:29 +08:00
sunli
50347bc415 v1.6.0 2020-03-26 11:34:28 +08:00
sunli
41fd8ed40e v1.5.1 2020-03-25 11:39:28 +08:00
sunli
2fc056ad39 v1.5.0
Improve performance
2020-03-24 18:54:22 +08: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
e6cfaf134e Support subscription 2020-03-17 17:26:59 +08:00
sunli
f78a172241 Add support for multipart request 2020-03-14 11:46:20 +08:00
sunli
32703f6fe3 add some validation rules 2020-03-10 14:14:09 +08:00
sunli
482c5b3cf3 v0.10.4 2020-03-09 18:05:52 +08:00
sunli
70c0b96395 Fixed a problem with the return value reference context lifetime 2020-03-07 18:03:19 +08:00
sunli
901c79993f hide ContextBase export 2020-03-07 11:27:44 +08:00
sunli
643c70c473 Update context.rs 2020-03-07 00:19:22 +08:00
sunli
70322b9a37 implemented interface 2020-03-06 23:58:43 +08:00
sunli
2351e75f2c fix some bug
add starwars example
2020-03-05 21:34:31 +08:00
sunli
b3340680ba v0.8.0 2020-03-05 17:06:14 +08:00
sunli
b3974737fc implemented query fragment 2020-03-05 15:50:57 +08:00
sunli
cc96dba8d8 add actix-web example 2020-03-05 08:39:56 +08:00
sunli
92a95dbbf4 implemented directive (@include, @skip) 2020-03-04 14:24:44 +08:00
sunli
b7a65b6784 support variables 2020-03-04 11:51:42 +08:00
sunli
602f6a656f Support default values 2020-03-04 10:38:07 +08:00
sunli
d0c6db0aba add schema support 2020-03-03 19:15:18 +08:00
sunli
8f448c91e9 create type info 2020-03-03 11:48:49 +08:00
sunli
cb96ba9048 hide some object 2020-03-02 01:15:05 +08:00
sunli
781aabdff0 variables supported 2020-03-02 00:52:05 +08:00
sunli
b62abdcd83 add InputObject 2020-03-01 21:35:39 +08:00
sunli
5030a28361 init commit 2020-03-01 18:54:34 +08:00