Skip to content

Create scalar with object value #1090

Closed
@KennethGomez

Description

@KennethGomez

I've created without issues a GraphQLScalar that admits JSON from serde_json but when using it for queries I get the following error:

{
  "error": {
    "errors": [
      {
        "message": "Variable \"$obj\" got invalid value. Expected \"JsonScalar\", found object.",
        "locations": [
          {
            "line": 1,
            "column": 8
          }
        ]
      }
    ]
  }
}

Query:

query($obj:JsonScalar!){
  getAccounts(where: {
    properties: {
      _eq: $obj
    }
  }) {
    _key
    firstName
    lastName
  }
}

Query variables:

{ "obj": {"a": 1, "b": "c"} }

How can I actually define that JsonScalar is an alias for objects for GraphQL?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions