gazuntype / graphQL-client-unity

This repository houses a unitypackage that can be included in your Unity Project to enable it communicate with a graphQL server.
Apache License 2.0
292 stars 50 forks source link

Request Error #38

Open wearstudio opened 2 years ago

wearstudio commented 2 years ago

Hi! Our backend team create schema with mutation

--data '{"query":"mutation Login { login(input: { email: \"example@app.app\", password: \"aasdasd" }) { __typename, ...on LoginAuthToken { accessToken refreshToken }, ...on InvalidCredentials { message } }}"}'

In unity inspector it look like

image

When I try to execute query i have error GraphApi.Query query = _requests.GetQueryByName("Login", GraphApi.Query.Type.Mutation); var result = await _requests.Post(query); Debug.Log(result.downloadHandler.text);

{"errors":[{"message":"Field \"login\" of type \"LoginUserResult!\" must have a selection of subfields. Did you mean \"login { ... }\"?","extensions":{"code":"GRAPHQL_VALIDATION_FAILED","exception":{"stacktrace":["GraphQLError: Field \"login\" of type \"LoginUserResult!\" must have a selection of subfields. Did you mean \"login { ... }\"?","
at Object.Field (/app/node_modules/graphql/validation/rules/ScalarLeafsRule.js:40:31)"," at Object.enter (/app/node_modules/graphql/language/visitor.js:323:29)"," at Object.enter (/app/node_modules/graphql/utilities/TypeInfo.js:370:25)","
at visit (/app/node_modules/graphql/language/visitor.js:243:26)"," at validate (/app/node_modules/graphql/validation/validate.js:69:24)"," at validate (/app/node_modules/apollo-server-core/dist/requestPipeline.js:187:39)","
at processGraphQLRequest (/app/node_modules/apollo-server-core/dist/requestPipeline.js:90:34)","
at runMicrotasks ()"," at processTicksAndRejections (node:internal/process/task_queues:96:5)","
at async processHTTPRequest (/app/node_modules/apollo-server-core/dist/runHttpQuery.js:187:30)"]}}}]}

Can you help me?