Migrate resource manager resources generation to TypeSpec - #50111
Migrate resource manager resources generation to TypeSpec#50111Weidong Xu (weidongxu-microsoft) wants to merge 38 commits into
Conversation
Regenerate the features, locks, and changes Swagger projects while removing generated code owned by projects migrating to TypeSpec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Remove generated policy samples that are no longer owned by the retained Swagger projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Replace the AutoRest deletion marker in files owned by the retained Swagger projects so TypeSpec regeneration does not remove them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Add the data boundaries TypeSpec checkpoint, scoped metadata, and ResourceManager-based generated samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Record the data boundaries checkpoint and reusable workflow for the remaining multi-source generation steps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Add the deployment stacks TypeSpec-generated client at API version 2024-03-01 and preserve the legacy ActionOnUnmanage enum signatures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Regenerate deployment stacks with the legacy Java properties flattening used by the original Swagger client. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Generate the policy client at API version 2026-07-01 and preserve the legacy policy exemption client and models for compatibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Add an AST customization limited to PolicyClient and PolicyClientImpl so the preserved policy exemption client remains accessible. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Target the generated PolicyClient interface declaration and emit a marker Override annotation on its implementation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Apply the Java AST customization to expose the preserved PolicyExemptionsClient through PolicyClient and PolicyClientImpl. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Add policy samples for the TypeSpec-generated 2026-07-01 surface while retaining earlier project samples and excluding stale generated tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Generate the subscription client into the combined resources package while preserving the original client grouping and API version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Use the package-specific subscription client accessor from the shared ResourceManager entry point. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Keep ResourceReference extensible for the deployment-stacks ManagedResourceReference model after deployments generation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Generate deployment clients and models into the combined resources package while preserving premium inner models, UUID types, and ResourceReference inheritance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Use the package-specific deployment client accessor from the handwritten ResourceManager entry point. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Complete the combined resources package generation with the original client grouping, tag client name, and shared-model compatibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Add TypeSpec samples for providers, resource groups, provider resource types, and tag operations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Restore AssignmentScopeValidation required by policy exemption compatibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Refresh playback assets for TypeSpec URI casing and trailing slash changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Allow azure-core to deserialize TypeSpec paging models through reflection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Regenerate deployment stacks with separate model and delete parameter enum types, document accepted Policy service removals, and suppress reviewed migration differences. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Skip pre-generation source cleanup for azure-resourcemanager-resources so generating one TypeSpec project does not delete outputs from the package's other projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Generate the PolicyExemptions accessor without an explicit public modifier on the PolicyClient interface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Use the core resources project in the Azure azure-rest-api-specs repository as the package's default generation location. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Add the Policy Exemptions client accessor and implementation only when the selected API version does not generate them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Remove the task working notes from the pull request while retaining the local file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
|
Azure Pipelines: Successfully started running 2 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Specs PR at Azure/azure-rest-api-specs#45423 One major problem is that we need run an extra step to pin other lib (e.g. policy) to generate from stable (in AutoPR), if e.g. resources need to release for next stable. And if e.g. policy need to release preview, we need then unpin it. Seems the best we can do is to always pin them at stable. Then only unpin when any need to release a preview. Another minor problem is a generate will delete all generated samples that not belong to it. Will handle this later, as worst case it still manageable in AutoPR. Also need a new emitter release for the samples anyway Another minor problem is duplicate files (from CommonTypes I guess). Likely going to have emitter support Another emitter fix |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
| "code": "java.method.removed", | ||
| "old": { | ||
| "matcher": "regex", | ||
| "match": "method .* com\\.azure\\.resourcemanager\\.resources\\.models\\.PolicyLogInfo\\:\\:(ancestors|complianceReasonCode|policyAssignmentDisplayName|policyDefinitionDisplayName|policyDefinitionGroupNames|policyExemptionIds|policySetDefinitionCategory|policySetDefinitionDisplayName|resourceLocation)\\(\\)" |
There was a problem hiding this comment.
policy just removed them as "bug fix" https://github.com/Azure/azure-rest-api-specs/pull/43353/changes#diff-c1419a1c98902586e334cf8112deb57a3f3771898cb89038b038a76ea2853b14
There was a problem hiding this comment.
This is to handle the mistake we made a long time ago -- we release GA on a tag that includes PolicyExemptions that still is preview.
The client/model class was converted as handwritten. The MangementClient would need a customizatoin.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
|
Azure Pipelines: Successfully started running 2 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4fc3370c-93f9-4237-862a-f239ff79cc86
Summary
Fixes #49803.
Testing
mvn -f sdk/resources/azure-resourcemanager-resources/pom.xml test2.54.2completes without API compatibility failures.