diff --git a/specification/compute/resource-manager/readme.go.md b/specification/compute/resource-manager/readme.go.md index 5144774ed3b6..9718cedf2f5f 100644 --- a/specification/compute/resource-manager/readme.go.md +++ b/specification/compute/resource-manager/readme.go.md @@ -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: >- @@ -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 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) @@ -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: >