Skip to content

Fix remove-model in TypeSpec Java management generation - #11698

Merged
Weidong Xu (weidongxu-microsoft) merged 2 commits into
microsoft:mainfrom
weidongxu-microsoft:fix/http-client-java-remove-model
Aug 17, 2026
Merged

Fix remove-model in TypeSpec Java management generation#11698
Weidong Xu (weidongxu-microsoft) merged 2 commits into
microsoft:mainfrom
weidongxu-microsoft:fix/http-client-java-remove-model

Conversation

@weidongxu-microsoft

Copy link
Copy Markdown
Contributor

Summary

  • apply remove-model to the active TypeSpec Fluent model mapper
  • omit configured enum models from management client generation
  • add regression coverage for factory-selected model mappers

Follow-up to #11658.

Validation

  • npm run build
  • npm run format
  • targeted FluentMapperTests
  • generated the Policy client from azure-rest-api-specs commit 8199a40d; all 11 configured models and enums were absent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 896b64bc-5bf6-4cb3-8b84-089eb78e20c7
@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-client-java
Show changes

@typespec/http-client-java - fix ✏️

Fix remove-model for TypeSpec management clients, including enum models.

@azure-sdk-automation

azure-sdk-automation Bot commented Aug 17, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

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.

Pull request overview

This PR fixes how the remove-model option is applied during TypeSpec Java management (Fluent) generation by ensuring the active (factory-selected) model mapper receives the removed-model set, and by preventing configured enum models from being emitted.

Changes:

  • Route remove-model into the factory-selected ModelMapper used by Fluent management generation (instead of always using the singleton instance).
  • Skip emitting enum types whose names are configured in remove-model.
  • Add a regression test to ensure remove-model is applied to the configured model mapper implementation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/http-client-java/generator/http-client-generator-mgmt/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMapperTests.java Adds regression coverage ensuring remove-model is applied to the factory-selected model mapper.
packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMapper.java Applies removed models to the active (factory-selected) Fluent model mapper.
packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGen.java Omits configured enum models from template emission.
.chronus/changes/http-client-java-remove-model-generation-2026-08-17.md Adds changelog entry for the remove-model fix in management generation.

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

…/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMapperTests.java

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Merged via the queue into microsoft:main with commit 1a15835 Aug 17, 2026
35 checks passed
@weidongxu-microsoft
Weidong Xu (weidongxu-microsoft) deleted the fix/http-client-java-remove-model branch August 17, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:java Issue for the Java client emitter: @typespec/http-client-java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants