This commit is contained in:
Sunli 2020-11-14 08:42:21 +08:00
commit 5a1cb7d9ad
11 changed files with 36 additions and 16 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql"
version = "2.1.0"
version = "2.1.1"
authors = ["sunli <scott_s829@163.com>", "Koxiaet"]
edition = "2018"
description = "A GraphQL server library implemented in Rust"
@ -36,9 +36,9 @@ string_number = ["num-traits"]
nightly = []
[dependencies]
async-graphql-derive = { path = "derive", version = "=2.0.16" }
async-graphql-derive = { path = "derive", version = "=2.1.1" }
async-graphql-value = { path = "value", version = "=2.0.5" }
async-graphql-parser = { path = "parser", version = "=2.0.8" }
async-graphql-parser = { path = "parser", version = "=2.1.1" }
async-stream = "0.3"
async-trait = "0.1.41"

View File

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

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-actix-web"
version = "2.1.0"
version = "2.1.1"
authors = ["sunli <scott_s829@163.com>", "Koxiaet"]
edition = "2018"
description = "async-graphql for actix-web"
@ -12,7 +12,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "=2.1.0" }
async-graphql = { path = "../..", version = "=2.1.1" }
actix = "0.10.0"
actix-http = "2.0.0"

View File

@ -14,7 +14,7 @@ keywords = ["futures", "async", "graphql", "rocket"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "=2.1.0" }
async-graphql = { path = "../..", version = "=2.1.1" }
rocket = { git = "https://github.com/SergioBenitez/Rocket/", rev = "0c150c2", default-features = false } # TODO: Change to Cargo crate when Rocket 0.5.0 is released
serde = "1.0.117"

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-tide"
version = "2.1.0"
version = "2.1.1"
authors = ["vkill <vkill.net@gmail.com>"]
edition = "2018"
description = "async-graphql for tide"
@ -12,7 +12,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "=2.1.0" }
async-graphql = { path = "../..", version = "=2.1.1" }
tide = { version = "0.14.0", default-features = false, features = ["h1-server"] }

View File

@ -1,6 +1,6 @@
[package]
name = "async-graphql-warp"
version = "2.1.0"
version = "2.1.1"
authors = ["sunli <scott_s829@163.com>", "Koxiaet"]
edition = "2018"
description = "async-graphql for warp"
@ -12,7 +12,7 @@ keywords = ["futures", "async", "graphql"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-graphql = { path = "../..", version = "=2.1.0" }
async-graphql = { path = "../..", version = "=2.1.1" }
warp = { version = "0.2.5", default-features = false, features = ["websocket"] }
futures-util = { version = "0.3.6", default-features = false }

View File

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

View File

@ -47,8 +47,8 @@ object_type = {
implements_interfaces = { "implements" ~ "&"? ~ name ~ ("&" ~ name)* }
interface_type = {
string? ~ "interface" ~ name ~ const_directives? ~ fields_definition?
| extend ~ "interface" ~ name ~ (const_directives? ~ fields_definition | const_directives)
string? ~ "interface" ~ name ~ implements_interfaces? ~ const_directives? ~ fields_definition?
| extend ~ "interface" ~ name ~ implements_interfaces? ~ (const_directives? ~ fields_definition | const_directives)
}
fields_definition = { "{" ~ field_definition+ ~ "}" }

View File

@ -149,12 +149,26 @@ fn parse_type_definition(
)
}
Rule::interface_type => {
let implements = parse_if_rule(&mut pairs, Rule::implements_interfaces, |pair| {
debug_assert_eq!(pair.as_rule(), Rule::implements_interfaces);
pair.into_inner()
.map(|pair| parse_name(pair, pc))
.collect::<Result<_>>()
})?;
let directives = parse_opt_const_directives(&mut pairs, pc)?;
let fields = parse_if_rule(&mut pairs, Rule::fields_definition, |pair| {
parse_fields_definition(pair, pc)
})?
.unwrap_or_default();
(directives, TypeKind::Interface(InterfaceType { fields }))
(
directives,
TypeKind::Interface(InterfaceType {
implements: implements.unwrap_or_default(),
fields,
}),
)
}
Rule::union_type => {
let directives = parse_opt_const_directives(&mut pairs, pc)?;

View File

@ -112,6 +112,8 @@ pub struct FieldDefinition {
/// [Reference](https://spec.graphql.org/June2018/#InterfaceType).
#[derive(Debug, Clone)]
pub struct InterfaceType {
/// The interfaces implemented by the interface.
pub implements: Vec<Positioned<Name>>,
/// The fields of the interface type.
pub fields: Vec<Positioned<FieldDefinition>>,
}

View File

@ -1,3 +1,7 @@
type Type1 implements IOne
type Type1 implements IOne & ITwo
interface Type1 implements IOne
interface Type1 implements IOne & ITwo