Provide type info to the concrete_type_name
This commit is contained in:
parent
d00e74bb4e
commit
bfe2ef511a
5 changed files with 6 additions and 6 deletions
|
@ -281,7 +281,7 @@ macro_rules! graphql_interface {
|
|||
$($items)*);
|
||||
}
|
||||
|
||||
fn concrete_type_name(&$mainself, context: &Self::Context) -> String {
|
||||
fn concrete_type_name(&$mainself, context: &Self::Context, _info: &()) -> String {
|
||||
graphql_interface!(
|
||||
@ concrete_type_name,
|
||||
($outname, context, $ctxt),
|
||||
|
|
|
@ -406,7 +406,7 @@ macro_rules! graphql_object {
|
|||
mt.into_meta()
|
||||
}
|
||||
|
||||
fn concrete_type_name(&self, _: &Self::Context) -> String {
|
||||
fn concrete_type_name(&self, _: &Self::Context, _: &()) -> String {
|
||||
$outname.to_owned()
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ macro_rules! graphql_union {
|
|||
mt.into_meta()
|
||||
}
|
||||
|
||||
fn concrete_type_name(&$mainself, context: &Self::Context) -> String {
|
||||
fn concrete_type_name(&$mainself, context: &Self::Context, _: &()) -> String {
|
||||
graphql_union!(
|
||||
@ concrete_type_name,
|
||||
($outname, context, $ctxt),
|
||||
|
|
|
@ -289,7 +289,7 @@ pub trait GraphQLType: Sized {
|
|||
///
|
||||
/// The default implementation panics.
|
||||
#[allow(unused_variables)]
|
||||
fn concrete_type_name(&self, context: &Self::Context) -> String {
|
||||
fn concrete_type_name(&self, context: &Self::Context, info: &Self::TypeInfo) -> String {
|
||||
panic!("concrete_type_name must be implemented by unions and interfaces");
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ where
|
|||
if f.name.item == "__typename" {
|
||||
result.insert(
|
||||
(*response_name).to_owned(),
|
||||
Value::string(instance.concrete_type_name(executor.context())),
|
||||
Value::string(instance.concrete_type_name(executor.context(), info)),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ pub fn impl_object(ast: &syn::DeriveInput) -> Tokens {
|
|||
Some(#name)
|
||||
}
|
||||
|
||||
fn concrete_type_name(&self, _: &Self::Context) -> String {
|
||||
fn concrete_type_name(&self, _: &Self::Context, _: &()) -> String {
|
||||
#name.to_string()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue