Skip to content

return Result from to_output_with of a scalar #1357

@nigimaxx

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> { ... }
}

Metadata

Metadata

Assignees

Labels

k::apiRelated to API (application interface)support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions