Skip to content

return Result from to_output_with of a scalar #1357

Description

@nigimaxx

Is it possible to implement a scalar that returns a result from its to_output method?

In the end it should look something like this:

#[derive( GraphQLScalar)]
#[graphql(
    name = "Scalar",
    to_output_with = Self::to_output,
    from_input_with = Self::from_input,
   )]
pub struct Scalar(bool);

impl Scalar {
    fn to_output(value: &Scalar) -> Result<String, Err> { ... }

    fn from_input(input: &str) -> Result<Self, Err> { ... }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions