Closed sridharchary closed 1 year ago
Please take a look at the documentation here You need to define the input type so the GraphQL client can use reflection to infer it.
type QuestionInput map[string]interface{}
variables := map[string]interface{}{
"data": QuestionInput {
"title": "My testFirst FbPost",
"description": "dfsdf is the body of my first post.",
"question_id": "35005",
},
}
Thanks a lot @hgiasac I am able to solve the issue now.
mutation query in graphql working fine
mutation createQuestion($data:QuestionInput!) { createQuestion(data: $data) { data{ id attributes{ title description question_id } } } }
mutation query in golang clientvar respData struct { CreateQuestion struct { Data []struct { ID graphql.ID Attributes struct { Question_id graphql.String Title graphql.String Description graphql.String } } }
} passing data Like thisvariables := map[string]interface{}{ "data": map[string]interface{}{ "title": "My testFirst FbPost", "description": "dfsdf is the body of my first post.", "question_id": "35005", }, }
It's gives Error when passing to server Strapi CMS server
GRAPHQL_PARSE_FAILED Syntax Error: Expected Name, found