cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Parameterized queries qraphQL

a1olegs
Node Clone

I want to make parameterized requests from the Apollo client to the Apollo server.
On client:

const GET_VALUES = gql`
    query Values($desc: String!) {      
        Values      
    }    
  `;
function ValueSelector({ pickValue, dirDesc }) { 
  const { loading, data, error } = useQuery(GET_VALUES, {
    variables: { dirDesc },
  });
}

On server(schema):

type Query {
  Values(desc: String!): [String]
  @cypher(
      statement: "MATCH (:Dir{description:$desc})-[:value]->(v) RETURN collect(v.TXTLG)"
    )  
}

result:
[GraphQL error]: Message: Field "Values" argument "desc" of type "String!" is required, but it was not provided., Location: [object Object], Path: undefined
[Network error]: ServerError: Response not successful: Received status code 400

1 REPLY 1

intouch_vivek
Graph Steward

Hi @a1olegs,

Looks like you have not initialized desc.
Kindly refer