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

Fix readme.go.md in compute RP #14631

Merged
merged 7 commits into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions specification/compute/resource-manager/readme.go.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

These settings apply only when `--go` is specified on the command line.

```yaml $(go) && !(track2)
```yaml $(go) && !$(track2)
go:
license-header: MICROSOFT_MIT_NO_VERSION
clear-output-folder: true

directive:
# dynamically add a DummyOrchestrationServiceName value to the enum
# dynamically add a DummyOrchestrationServiceName value to the enum and then remove it from the generated code to avoid the generator generates the code by hard-coding the single-entry enum value
# this directive adds a DummyOrchestrationServiceName to the enum type
- from: compute.json
where: $..enum
transform: >-
Expand All @@ -17,14 +18,15 @@ directive:
}
return $;

# this directive removes the DummyOrchestrationServiceName from the generated code, so that we still have only one enum entry in this enum type.
- from: source-file-go
Copy link
Member

Choose a reason for hiding this comment

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

So we don't need this any more for track 1?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do not need this anymore. Once the enum entry was added into the modeler, the generator can handle it properly. We do not need replace the generated code anymore.

where: $
transform: >-
return $.
replace(/\/\/ DummyOrchestrationServiceName .../g,'').
replace(/DummyOrchestrationServiceName OrchestrationServiceNames = "DummyOrchestrationServiceName"\n/g,'').
replace(/,DummyOrchestrationServiceName/,'').
replace(/, 'DummyOrchestrationServiceName'/,'');
replace(/\/\/ (OrchestrationServiceNames)?DummyOrchestrationServiceName .../g,'').
replace(/(OrchestrationServiceNames)?DummyOrchestrationServiceName OrchestrationServiceNames = "DummyOrchestrationServiceName"\n/g,'').
replace(/,(OrchestrationServiceNames)?DummyOrchestrationServiceName/,'').
replace(/, '(OrchestrationServiceNames)?DummyOrchestrationServiceName'/,'');
```

``` yaml $(go) && $(track2)
Expand All @@ -35,6 +37,7 @@ output-folder: $(go-sdk-folder)/$(module-name)
azure-arm: true

directive:
# we do not need to hack to add a dummy enum entry in track 2, because track 2 generator will generate the enum type even if it only has on entry
- from: disk.json
where: "$.definitions.PurchasePlan"
transform: >
Expand Down