Skip to content

Input serde_json::Value variable wrongly coerced to String #488

Open
@vindard

Description

@vindard

Description

I have a schema where some of the input types are JSON which expects json blobs. I've mapped this in the file where I'm deriving things using type JSON = serde_json::Value;.

In the actual code, the Variables type that got generated looks like this

pub struct Variables {
    pub transaction_id: Uuid,
    pub amount: Decimal,
    pub external_id: String,
    pub metadata: serde_json::Value,
}

But if I print the metadata field from a Variables instance I get a stringified version of the json value which errors when sent to the api.

Is there a setting I'm missing that can override this conversion?

#[derive(GraphQLQuery)]
#[graphql(
    schema_path = "src/ledger/cala/graphql/schema.graphql",
    query_path = "src/ledger/cala/graphql/transactions/add-equity.gql",
    response_derives = "Debug, PartialEq, Eq, Clone"
)]
pub struct PostAddEquityTransaction;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions