Merge pull request #199 from Danue1/master
Add a specification to implement the interface to the interface.
This commit is contained in:
commit
d208ed2860
@ -46,7 +46,7 @@ arguments_definition = { "(" ~ input_value_definition* ~ ")" }
|
|||||||
field_definition = { string? ~ name ~ arguments_definition? ~ ":" ~ type_ ~ directives? }
|
field_definition = { string? ~ name ~ arguments_definition? ~ ":" ~ type_ ~ directives? }
|
||||||
fields_definition = { "{" ~ field_definition* ~ "}" }
|
fields_definition = { "{" ~ field_definition* ~ "}" }
|
||||||
object_type_definition = { string? ~ extend? ~ "type" ~ name ~ implements_interfaces? ~ directives? ~ fields_definition? }
|
object_type_definition = { string? ~ extend? ~ "type" ~ name ~ implements_interfaces? ~ directives? ~ fields_definition? }
|
||||||
interface_type_definition = { string? ~ extend? ~ "interface" ~ name ~ directives? ~ fields_definition? }
|
interface_type_definition = { string? ~ extend? ~ "interface" ~ name ~ implements_interfaces? ~ directives? ~ fields_definition? }
|
||||||
union_member_types = { "=" ~ "|"? ~ name ~ ("|" ~ name)* }
|
union_member_types = { "=" ~ "|"? ~ name ~ ("|" ~ name)* }
|
||||||
union_type_definition = { string? ~ extend? ~ "union" ~ name ~ directives? ~ union_member_types? }
|
union_type_definition = { string? ~ extend? ~ "union" ~ name ~ directives? ~ union_member_types? }
|
||||||
enum_value_definition = { string? ~ name ~ directives? }
|
enum_value_definition = { string? ~ name ~ directives? }
|
||||||
|
@ -93,6 +93,7 @@ pub struct InterfaceType {
|
|||||||
pub extend: bool,
|
pub extend: bool,
|
||||||
pub description: Option<Positioned<String>>,
|
pub description: Option<Positioned<String>>,
|
||||||
pub name: Positioned<String>,
|
pub name: Positioned<String>,
|
||||||
|
pub implements_interfaces: Vec<Positioned<String>>,
|
||||||
pub directives: Vec<Positioned<Directive>>,
|
pub directives: Vec<Positioned<Directive>>,
|
||||||
pub fields: Vec<Positioned<Field>>,
|
pub fields: Vec<Positioned<Field>>,
|
||||||
}
|
}
|
||||||
|
@ -475,6 +475,7 @@ fn parse_interface_type(
|
|||||||
let mut description = None;
|
let mut description = None;
|
||||||
let mut extend = false;
|
let mut extend = false;
|
||||||
let mut name = None;
|
let mut name = None;
|
||||||
|
let mut implements_interfaces = None;
|
||||||
let mut directives = None;
|
let mut directives = None;
|
||||||
let mut fields = None;
|
let mut fields = None;
|
||||||
|
|
||||||
@ -485,6 +486,9 @@ fn parse_interface_type(
|
|||||||
}
|
}
|
||||||
Rule::extend => extend = true,
|
Rule::extend => extend = true,
|
||||||
Rule::name => name = Some(Positioned::new(pair.as_str().to_string(), pc.step(&pair))),
|
Rule::name => name = Some(Positioned::new(pair.as_str().to_string(), pc.step(&pair))),
|
||||||
|
Rule::implements_interfaces => {
|
||||||
|
implements_interfaces = Some(parse_implements_interfaces(pair, pc)?)
|
||||||
|
}
|
||||||
Rule::directives => directives = Some(parse_directives(pair, pc)?),
|
Rule::directives => directives = Some(parse_directives(pair, pc)?),
|
||||||
Rule::fields_definition => fields = Some(parse_fields_definition(pair, pc)?),
|
Rule::fields_definition => fields = Some(parse_fields_definition(pair, pc)?),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@ -496,6 +500,7 @@ fn parse_interface_type(
|
|||||||
extend,
|
extend,
|
||||||
description,
|
description,
|
||||||
name: name.unwrap(),
|
name: name.unwrap(),
|
||||||
|
implements_interfaces: implements_interfaces.unwrap_or_default(),
|
||||||
directives: directives.unwrap_or_default(),
|
directives: directives.unwrap_or_default(),
|
||||||
fields: fields.unwrap_or_default(),
|
fields: fields.unwrap_or_default(),
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
type Type1 implements IOne
|
type Type1 implements IOne
|
||||||
|
|
||||||
type Type1 implements IOne & ITwo
|
type Type1 implements IOne & ITwo
|
||||||
|
|
||||||
|
interface Type1 implements IOne
|
||||||
|
|
||||||
|
interface Type1 implements IOne & ITwo
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
type Type1 implements & IOne & ITwo
|
type Type1 implements & IOne & ITwo
|
||||||
type Type2 implements & IOne
|
type Type2 implements & IOne
|
||||||
|
|
||||||
|
interface Type1 implements & IOne & ITwo
|
||||||
|
interface Type2 implements & IOne
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
type Type1 implements IOne & ITwo
|
type Type1 implements IOne & ITwo
|
||||||
|
|
||||||
type Type2 implements IOne
|
type Type2 implements IOne
|
||||||
|
|
||||||
|
interface Type1 implements IOne & ITwo
|
||||||
|
|
||||||
|
interface Type2 implements IOne
|
||||||
|
Loading…
Reference in New Issue
Block a user