-
Notifications
You must be signed in to change notification settings - Fork 50
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
[BUG]: Mutation UpdateProjectV2ItemFieldValue fails with ProjectV2FieldValue has the wrong arguments error #292
Comments
ProjectV2FieldValue must provide exactly one property at a time per documentation: > The values that can be used to update a field of an item inside a > Project. Only 1 value can be updated at a time. > > https://docs.github.com/en/graphql/reference/input-objects#projectv2fieldvalue Fix this by skipping the serialization of null-valued properties. Fixes octokit#292
@nickfloyd, in true hacktoberfest spirit, I have a total hack-job of a fix for this. The problem is, it introduces a coupling from
|
In case others need a workaround for this, the Below is a basic example of how to do this for a 'single select' field, though this should work for other field types, just specify the proper field name when setting up the var productInformation = new ProductHeaderValue( "your_client_name_here", "x.x.x" );
var gitHubConnection = new Connection( productInformation, "your_PAT_here");
ID projectId = /*<retrieve this from another API call>*/;
ID itemId = /*<retrieve this from another API call>*/;
ID fieldId = /*<retrieve this from another API call>*/;
string singleSelectOptionId = <retrieve this from another API>;
string queryStr = $"{{ \"query\":\"mutation {{updateProjectV2ItemFieldValue(input:{{projectId:\\\"{projectId.Value}\\\", itemId:\\\"{itemId.Value}\\\", fieldId:\\\"{fieldId.Value}\\\", value:{{singleSelectOptionId:\\\"{singleSelectOptionId}\\\"}}, clientMutationId:null}}){{id: projectV2Item{{id}}}}}}\",\"variables\":null}}";
await gitHubConnection.Run( queryStr ); |
Is it required to explicitly send I see that it is asserted here but I'm not sure if that is verifying that it can serialize with a If it is not required, I have a raised a PR to skip them here #319 |
+1 for this, would like to see the #319 PR merged assuming it aligns with the correct version of the spec. |
…alue When running the import I am getting:an error: ``` 2024-08-09T16:27:38.959Z debug: Response: 200 OK - {"data":{"addProjectV2DraftIssue":{"projectItem":{"id":"PVTI_lADOABJSZ84AmAGazgRtVEU"}}}} 2024-08-09T16:27:38.959Z info: Created project item PVTI_lADOABJSZ84AmAGazgRtVEU based on source project item MDEzOlByb2plY3RWMkl0ZW0zNTA2 2024-08-09T16:27:38.959Z info: Setting field "Status" (1/1) on project item PVTI_lADOABJSZ84AmAGazgRtVEU... 2024-08-09T16:27:38.960Z debug: Request: POST https://api.github.com/graphql - mutation updateProjectItemFieldValue($projectId: ID!, $itemId: ID!, $fieldId: ID!, $value: ProjectV2FieldValue!) { updateProjectV2ItemFieldValue(input: { projectId: $projectId, itemId: $itemId, fieldId: $fieldId, value: $value }) { projectV2Item { id } } } 2024-08-09T16:27:39.645Z debug: Response: 200 OK - {"data":{"updateProjectV2ItemFieldValue":null},"errors":[{"path":["updateProjectV2ItemFieldValue"],"locations":[{"line":3,"column":7}],"message":"ProjectV2FieldValue has the wrong arguments"}]} Request failed due to following response errors: - ProjectV2FieldValue has the wrong arguments GraphqlResponseError: Request failed due to following response errors: - ProjectV2FieldValue has the wrong arguments at /snapshot/dist/migrate-project.cjs at async updateProjectItemFieldValue (/snapshot/dist/migrate-project.cjs) at async importProjectItem (/snapshot/dist/migrate-project.cjs) at async /snapshot/dist/migrate-project.cjs at async _Command.<anonymous> (/snapshot/dist/migrate-project.cjs) ``` Our hackathon project uses a singleSelectOptionId for the item's status field which seems similar to this issue on the the dotnet graphql client: octokit/octokit.graphql.net#292 Trying a similar fix here, remove the nulls from the value object before sending it to github.
What happened?
When performing an UpdateProjectV2ItemFieldValue mutation the response returns with a
ProjectV2FieldValue has the wrong arguments error
Below is the generated query:
It appears that the value object
ProjectV2FieldValue
cannot be passed with more than one property per request. Performing a request without the additional null properties does succeed:Thanks
Versions
v0.2.0-beta
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: