Skip to content

fix: omit unused Dart composed discriminator imports - #8346

Merged
Vincent Biret (baywet) merged 3 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-dart-composed-imports
Oct 8, 2026
Merged

Vincent Biret (baywet) merged 3 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-dart-composed-imports

Conversation

@rksharma-owg

@rksharma-owg RKS (rksharma-owg) commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7821.

This addresses the missing model import reported as error type 4. Dart composed wrappers import every discriminator mapping even though their factories use their member types. In the GitHub contents response this adds an unused import of a model that was pruned, causing Dart analysis to fail with uri_does_not_exist.

Opt Dart into the shared helper's existing composed-type import filter, as Java already does. Member imports, inherited-model discriminator imports, and ParseNode correction remain covered by three refiner cases. This changes import hygiene without changing discriminator selection.

Merged current main (b6f532aee) to resolve conflicts, preserving upstream changes and the focused three-file contribution.

Validation of 5f8029f8eb42c2d91bef29a5c67aff44c9afebd4:

  • Restore, formatting, and build pass. Full solution: 3,037 passed, three existing skips.
  • Exact-commit fork validation: .NET, CodeQL, integration-tests, idempotency-tests, surface-area-tests. The .NET workflow includes the upstream five-OS release matrix and VS Code extension build/test matrix. Existing integration/idempotency suppressions remain unchanged.
  • Compiler regression compares baseline and patched generated Dart clients. The refiner regression covers union, intersection, and inherited-model imports alongside upstream default-value tests.
  • Required fork checks pass. 10 optional integration/idempotency cases failed under the repository’s existing documented suppressions; these are not counted as passing cases.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 03:12
@rksharma-owg
RKS (rksharma-owg) requested a review from a team as a code owner October 7, 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 review overview

🟢 Approval recommended

The targeted change reuses established filtering behavior and includes coverage for composed and inherited models.

Review effort: Balanced
Findings: None

What changed in this PR

Updates Dart refinement to avoid invalid, unused discriminator imports in composed wrappers.

Changes:

  • Disables discriminator-mapping imports for Dart composed types.
  • Adds union, intersection, and inheritance regression coverage.
  • Documents the fix for #7821.
File Description
src/​Kiota.Builder/​Refiners/​DartRefiner.cs Applies the composed-type import filter.
tests/​Kiota.Builder.Tests/​Refiners/​DartLanguageRefinerTests.cs Verifies retained and omitted imports.
CHANGELOG.md Records the Dart fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 14:02

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

The targeted change matches Dart factory behavior and includes appropriate regression coverage.

Review effort: Balanced
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.

Thanks for the contribution!

@baywet
Vincent Biret (baywet) added this pull request to the merge queue Oct 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 7, 2026
Copilot AI balanced review requested due to automatic review settings October 8, 2026 03:48
@github-actions

github-actions Bot commented Oct 8, 2026

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.

🟢 Approval recommended

The targeted change matches Dart factory behavior and includes coverage for all affected composition cases.

0 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@baywet
Vincent Biret (baywet) added this pull request to the merge queue Oct 8, 2026
Merged via the queue into microsoft:main with commit 542d9e4 Oct 8, 2026
338 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.

[Dart] Compilation errors for GITHUB.COM api

3 participants