Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor sample generator in mgmt #5107

Merged
merged 61 commits into from
Nov 26, 2024

Conversation

ArcturusZhang
Copy link
Member

@ArcturusZhang ArcturusZhang commented Oct 10, 2024

Fixes #5079

Description

A thorough refactor on how the samples are written in mgmt plane.

  • Move the part that converts an example value into expression to the common place, so that the mgmt sample generator could call it as well
  • Sample generation is no longer a standalone target. It is now part of the target of generating the source code.
  • MgmtTestConfiguration remains. We will refactor those parts in later PRs, including introducing similar configurations to typespec input

About changes in regen PR:
We do have quite a lot of changes in the regen PR, because now to generate the content of the sample, we are reusing the code written for DPG's sample a few months ago, which introduces quite a few style changes, such as, previously we might have:

VirtualMachineData data = new VirtualMachineData()
{
	Location = AzureLocation.WestUS
};

now we might have:

VirtualMachineData data = new VirtualMachineData
{
	Location = AzureLocation.WestUS
};

Also because of now sample generation is not in a standalone target, we have quite a few order changes in those generated methods.
To summary, the majority of those massive changes in the regen PR come from the style change, or ordering change.

Checklist

To ensure a quick review and merge, please ensure:

  • The PR has a understandable title and description explaining the why and what.
  • The PR is opened in draft if not ready for review yet.
    • If opened in draft, please allocate sufficient time (24 hours) after moving out of draft for review
  • The branch is recent enough to not have merge conflicts upon creation.

Ready to Land?

  • Build is completely green
    • Submissions with test failures require tracking issue and approval of a CODEOWNER
  • At least one +1 review by a CODEOWNER
  • All -1 reviews are confirmed resolved by the reviewer
    • Override/Marking reviews stale must be discussed with CODEOWNERS first

@ArcturusZhang

This comment was marked as outdated.

@ArcturusZhang ArcturusZhang merged commit 53fbd40 into Azure:main Nov 26, 2024
8 checks passed
@ArcturusZhang ArcturusZhang deleted the refactor-mgmt-sample-generator branch November 26, 2024 02:54
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.

Refactor the sample generation code for MPG to reuse some code in DPG sample generation
2 participants