Skip to content

fix: deserialize enum values in Go union factories - #8234

Merged
Vincent Biret (baywet) merged 13 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/go-union-enum-cast
Oct 5, 2026
Merged

Vincent Biret (baywet) merged 13 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/go-union-enum-cast

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham Padkonde (Shubham-Padkonde) commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7808.

Go union factories pass the interface{} returned by GetEnumValue directly 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:

  • 77 Go writer tests passed, with one existing skip.
  • The .NET 10 generator build passed.
  • Downloaded the current full Notion OpenAPI description, generated its Go client, and successfully ran go build ./... using Go 1.26.4 and the repository's integration dependencies.
  • git diff --check passed.

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 ./... and go 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@baywet

Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings September 21, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please?

Copilot AI review requested due to automatic review settings September 23, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) this PR is not linked to an issue, can you edit the initial PR description and add fixes #issueNumber to make it clear which issue will be closed please, or at least partial #issuenumber if multiple PRs are required for this issue to be solved

Copilot AI review requested due to automatic review settings September 23, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 23, 2026 17:16
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 28, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI lite review requested due to automatic review settings September 30, 2026 03:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) can you also remove the suppressions in the integration test config please?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved issues remain, and validation covers the fixes.

Review effort: Lite
Findings: None

@baywet
Vincent Biret (baywet) added this pull request to the merge queue Oct 5, 2026
Merged via the queue into microsoft:main with commit 07750dd Oct 5, 2026
331 checks passed
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

Successfully merging this pull request may close these issues.

[Go] Compilation errors for NOTION.COM api

3 participants