Skip to content
","upvoteCount":1,"answerCount":4,"acceptedAnswer":{"@type":"Answer","text":"

@stanhangzhou Rust representation of schema you've described in original question would look something like:

\n
#[graphql_interface]\ntrait ImageData {\n    fn src(&self) -> String;\n    fn content_type(&self) -> Option<String>,\n}\n\n#[graphql_interface]\ntrait CollectionVolume {\n    fn change_24h(&self) -> Option<i32>;\n}\n\n#[graphql_interface]\ntrait UserAvatarOmit {\n    fn id(&self) -> String;\n    fn token_id(&self) -> String;\n    fn image(&self) -> ImageDataValue;\n}\n\n#[graphql_interface]\ntrait UserAvatarOmit {\n    fn address(&self) -> String;\n    fn is_verified(&self) -> bool;\n    fn name(&self) -> String;\n    fn avatar(&self) -> Option<UserAvatarOmitValue>;\n}\n\n#[graphql_interface]\ntrait CollectionBase {\n    fn name(&self) -> String;\n    fn logo(&self) -> Option<ImageDataValue>;\n}
","upvoteCount":1,"url":"https://github.com/graphql-rust/juniper/discussions/1093#discussioncomment-3453796"}}}

interface field as interface inherit to maping not implement error #1093

Answered by ilslv
stanhangzhou asked this question in Q&A
Discussion options

You must be logged in to vote

@stanhangzhou Rust representation of schema you've described in original question would look something like:

#[graphql_interface]
trait ImageData {
    fn src(&self) -> String;
    fn content_type(&self) -> Option<String>,
}

#[graphql_interface]
trait CollectionVolume {
    fn change_24h(&self) -> Option<i32>;
}

#[graphql_interface]
trait UserAvatarOmit {
    fn id(&self) -> String;
    fn token_id(&self) -> String;
    fn image(&self) -> ImageDataValue;
}

#[graphql_interface]
trait UserAvatarOmit {
    fn address(&self) -> String;
    fn is_verified(&self) -> bool;
    fn name(&self) -> String;
    fn avatar(&self) -> Option<UserAvatarOmitValue>;
}

#[graphql_interface]
trait Collecti…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ilslv
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@stanhangzhou
Comment options

Answer selected by ilslv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants