Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master

This commit is contained in:
Koxiaet 2020-09-09 17:06:36 +01:00
commit f1af4ea195
16 changed files with 33 additions and 32 deletions

View File

@ -10,10 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install libsqlite3-dev
run: |
sudo apt-get update

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql"
version = "1.17.21"
version = "1.18.0"
authors = ["sunli <scott_s829@163.com>"]
edition = "2018"
description = "A GraphQL server library implemented in Rust"
@ -17,10 +17,9 @@ readme = "README.md"
default = ["bson", "url", "chrono-tz"]
[dependencies]
async-graphql-derive = { path = "derive", version = "1.17.21" }
async-graphql-parser = { path = "parser", version = "1.17.3" }
async-graphql-derive = { path = "derive", version = "1.18.0" }
async-graphql-parser = { path = "parser", version = "1.18.0" }
Inflector = "0.11.4"
anyhow = "1.0.26"
async-stream = "0.2.1"
async-trait = "0.1.30"

View File

@ -1,6 +1,6 @@
[package]
name = "graphql-benchmark"
version = "1.17.3"
version = "1.18.0"
authors = ["sunli <scott_s829@163.com>"]
edition = "2018"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-derive"
version = "1.17.21"
version = "1.18.0"
authors = ["sunli <scott_s829@163.com>"]
edition = "2018"
description = "Macros for async-graphql"
@ -16,7 +16,7 @@ categories = ["network-programming", "asynchronous"]
proc-macro = true
[dependencies]
async-graphql-parser = { path = "../parser", version = "1.17.2" }
async-graphql-parser = { path = "../parser", version = "1.18.0" }
proc-macro2 = "1.0.6"
syn = { version = "1.0.20", features = ["full", "extra-traits"] }
quote = "1.0.3"

View File

@ -4,10 +4,10 @@
```toml
[dependencies]
async-graphql = "1.17.15"
async-graphql-actix-web = "1.17.3" # If you need to integrate into actix-web
async-graphql-warp = "1.17.3" # If you need to integrate into warp
async-graphql-tide = "1.17.9" # If you need to integrate into tide
async-graphql = "1.18.0"
async-graphql-actix-web = "1.18.0" # If you need to integrate into actix-web
async-graphql-warp = "1.18.0" # If you need to integrate into warp
async-graphql-tide = "1.18.0" # If you need to integrate into tide
```
## Write a Schema

View File

@ -4,10 +4,10 @@
```toml
[dependencies]
async-graphql = "1.11.0"
async-graphql-actix-web = "1.3.0" # 如果你需要集成到Actix-web
async-graphql-warp = "1.3.0" # 如果你需要集成到Warp
async-graphql-tide = "1.2.0" # 如果你需要集成到Tide
async-graphql = "1.18.0"
async-graphql-actix-web = "1.18.0" # 如果你需要集成到Actix-web
async-graphql-warp = "1.18.0" # 如果你需要集成到Warp
async-graphql-tide = "1.18.0" # 如果你需要集成到Tide
```
## 写一个Schema

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-actix-web"
version = "1.17.18"
version = "1.18.0"
authors = ["sunli <scott_s829@163.com>"]
edition = "2018"
description = "async-graphql for actix-web"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "1.17.2" }
async-graphql = { path = "../..", version = "1.18.0" }
actix-web = "2.0.0"
actix-web-actors = "2.0.0"
actix = "0.9.0"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-lambda"
version = "1.14.0"
version = "1.18.0"
authors = ["Sunli <scott_s829@163.com>"]
edition = "2018"
description = "async-graphql for AWS Lambda"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "1.17.2" }
async-graphql = { path = "../..", version = "1.18.0" }
lambda_http = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" }
futures = "0.3.0"
async-trait = "0.1.30"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-rocket"
version = "1.17.21"
version = "1.18.0"
authors = ["Daniel Wiesenberg <daniel@simplificAR.io>"]
edition = "2018"
description = "async-graphql for Rocket.rs"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql", "rocket"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "1.17.21" }
async-graphql = { path = "../..", version = "1.18.0" }
rocket = { git = "https://github.com/SergioBenitez/Rocket/", rev = "dc2c6ec", default-features = false } #TODO: Change to Cargo crate, when Rocket 0.5.0 is released
log = "0.4.11"
yansi = "0.5.0"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-tide"
version = "1.17.9"
version = "1.18.0"
authors = ["vkill <vkill.net@gmail.com>"]
edition = "2018"
description = "async-graphql for tide"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "1.17.2" }
async-graphql = { path = "../..", version = "1.18.0" }
tide = "0.13.0"
async-trait = "0.1.36"
serde_json = "1.0.56"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-warp"
version = "1.17.18"
version = "1.18.0"
authors = ["sunli <scott_s829@163.com>"]
edition = "2018"
description = "async-graphql for warp"
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "1.17.2" }
async-graphql = { path = "../..", version = "1.18.0" }
warp = "0.2.2"
futures = "0.3.0"
bytes = "0.5.4"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-parser"
version = "1.17.3"
version = "1.18.0"
authors = ["sunli <scott_s829@163.com>"]
edition = "2018"
description = "GraphQL query parser for async-graphql"

View File

@ -140,7 +140,8 @@ impl<'a> Display for QueryPathNode<'a> {
}
impl<'a> QueryPathNode<'a> {
pub(crate) fn field_name(&self) -> &str {
/// Get the current field name.
pub fn field_name(&self) -> &str {
let mut p = self;
loop {
if let QueryPathSegment::Name(name) = &p.segment {

View File

@ -5,7 +5,7 @@ mod logger;
mod tracing;
use crate::context::{QueryPathNode, ResolveId};
use crate::{Result, Variables};
use crate::{Context, Result, Variables};
pub use self::apollo_tracing::ApolloTracing;
pub use self::logger::Logger;
@ -28,6 +28,9 @@ pub struct ResolveInfo<'a> {
/// Current path node, You can go through the entire path.
pub path_node: &'a QueryPathNode<'a>,
/// Context
pub context: &'a Context<'a>,
/// Parent type
pub parent_type: &'a str,

View File

@ -64,6 +64,7 @@ fn do_resolve<'a, T: ObjectType + Send + Sync>(
let resolve_info = ResolveInfo {
resolve_id: ctx_field.resolve_id,
path_node: ctx_field.path_node.as_ref().unwrap(),
context: &ctx_field,
parent_type: &T::type_name(),
return_type: match ctx_field
.schema_env

View File

@ -95,6 +95,7 @@ pub fn collect_fields<'a, T: ObjectType + Send + Sync>(
let resolve_info = ResolveInfo {
resolve_id: ctx_field.resolve_id,
path_node: ctx_field.path_node.as_ref().unwrap(),
context: &ctx_field,
parent_type: &T::type_name(),
return_type: match ctx_field
.schema_env