Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using patch in mutation. #264

Closed
libinvarkey opened this issue May 31, 2021 · 3 comments
Closed

Error when using patch in mutation. #264

libinvarkey opened this issue May 31, 2021 · 3 comments

Comments

@libinvarkey
Copy link

[[GraphQLError: Field "UpdateDmsPhysicalRwTblServiceAdvisorInput.nodeId" of required type "ID!" was not provided.], [GraphQLError: Field "UpdateDmsPhysicalRwTblServiceAdvisorInput.dmsPhysicalRwTblServiceAdvisorPatch" of required type "DmsPhysicalRwTblServiceAdvisorPatch!" was not provided.], [GraphQLError: Field "patch" is not defined by type "UpdateDmsPhysicalRwTblServiceAdvisorInput".], [GraphQLError: Field "id" is not defined by type "UpdateDmsPhysicalRwTblServiceAdvisorInput".]]

@benjie

@benjie
Copy link
Member

benjie commented May 31, 2021

The error tells you what’s wrong: your queries are invalid. Use the GraphiQL interface to learn what fields are available/required. Please follow the issue template in future.

@benjie benjie closed this as completed May 31, 2021
@libinvarkey
Copy link
Author

In my test test ,i passed the id but it shows Field "UpdateDmsPhysicalRwTblServiceAdvisorInput.nodeId" of required type "ID!" was not provided
("allDmsPhysicalRoVwStoreMasters", async () => {
//const data = GetDashboardItemsData;
await RunGraphQLQuery(
// GraphQL query goes here:
mutation updatePayTypeMaster( $id: Int! $pay_type: String $pay_type_code: String $department: String $store_id: String ) { updateDmsPhysicalRwPayTypeMaster( input: { patch: { payType: $pay_type payTypeCode: $pay_type_code department: $department storeId: $store_id } id: $id } ) { dmsPhysicalRwPayTypeMaster { id } } } ,
// GraphQL variables:
{

    id: 34,
    Pay_type: 'test',
    pay_type_code: 'CH',
    department: 'REPAIR',
    store_id: '34567'
},
// Additional props to add to `req` (e.g. `user: {session_id: '...'}`)
{},
// This function runs all your test assertions:
async (json) => {
  
  expect(json.errors).toBeFalsy();
  expect(json.data).toBeTruthy();
  expect(json.data.allDmsPhysicalRoVwStoreMasters.totalCount).toBe(2);
  // expect(json.data.currentUser).toMatchObject({
  //     id: user.id,
  // });
}

);
});
@benjie

@benjie
Copy link
Member

benjie commented May 31, 2021

The operation is not valid, because the field UpdateDmsPhysicalRwTblServiceAdvisorInput.nodeId (which was expecting an ID!) was not provided. You've passed id: $id whereas the mutation is expecting nodeId: ...; if you copy it into GraphiQL as I've instructed then it will show you where the error is. You're using the wrong mutation; you want something like updateDmsPhysicalRwPayTypeMasterById - have a look in GraphiQL to determine which mutation you need for the inputs you have available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants