Repository navigation
fix: deserialize enum values in Go union factories - #8234
Vincent Biret (baywet) merged 13 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues remain, and regression coverage addresses the reported cases.
Review effort: Lite
Findings: None
What changed in this PR
Fixes Go union factory generation for scalar enum deserialization and undiscriminated unions.
Changes:
- Adds guarded enum type assertions.
- Skips empty discriminator lookups.
- Adds regression coverage and changelog documentation.
| File | Summary |
|---|---|
tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs |
Adds enum and discriminator regression tests. |
src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs |
Corrects union factory generation. |
CHANGELOG.md |
Documents the fixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Shubham Padkonde (@Shubham-Padkonde) your behaviour is disruptive, opening about 30 PRs on the repos in a couple of hours time, most likely code that was AI generated and not tested/reviewed, will only clog our review pipeline. Please stop opening additional pull requests and work on the comments added to existing ones. We have turned on pull requests limits on this repository, and will proceed to blocking you at the organization level if additional pull requests are opened on other repositories before the already opened ones are reviewed and closed/or merged. |
|
Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please? |
|
Shubham Padkonde (@Shubham-Padkonde) this PR is not linked to an issue, can you edit the initial PR description and add |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
|
Shubham Padkonde (@Shubham-Padkonde) can you also remove the suppressions in the integration test config please? |
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thank you for making the changes!
Fixes #7808.
Go union factories pass the
interface{}returned byGetEnumValuedirectly to a typed enum setter. Use the same guarded enum type assertion as intersection factories.The same undiscriminated factory also reads
GetChildNode(""); the JSON parse node rejects that before either enum or integer parsing can run. Read discriminator values only when discriminator information is present.Remove the Notion Go compilation suppression from the integration configuration, as requested in review, so the affected API is tested again.
Latest validation:
go build ./...using Go 1.26.4 and the repository's integration dependencies.git diff --checkpassed.Earlier regression validation showed the reduced enum/integer client failing compilation before the cast fix, and enum/integer JSON parsing failing before the empty-discriminator fix. The corrected reduced client passed
go test -race ./...andgo vet ./..., including both JSON runtime cases. Those runtime tests were not rerun for this configuration-only follow-up. Builds emit worktree SourceLink warnings. No live service calls were made. Developed and tested with AI assistance.