Skip to content

Commit 7a2f167

Browse files
Fix readme.go.md in compute RP (#14631)
* add the missing $ * remove one useless directive * fix * remove the hack for track 2 and add comments for reasons * add one of the directive back to readme.go.md * add some comment to explain this more * fix
1 parent 749d2b5 commit 7a2f167

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

specification/compute/resource-manager/readme.go.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

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

5-
```yaml $(go) && !(track2)
5+
```yaml $(go) && !$(track2)
66
go:
77
license-header: MICROSOFT_MIT_NO_VERSION
88
clear-output-folder: true
99

1010
directive:
11-
# dynamically add a DummyOrchestrationServiceName value to the enum
11+
# 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
12+
# this directive adds a DummyOrchestrationServiceName to the enum type
1213
- from: compute.json
1314
where: $..enum
1415
transform: >-
@@ -17,14 +18,15 @@ directive:
1718
}
1819
return $;
1920
21+
# this directive removes the DummyOrchestrationServiceName from the generated code, so that we still have only one enum entry in this enum type.
2022
- from: source-file-go
2123
where: $
2224
transform: >-
2325
return $.
24-
replace(/\/\/ DummyOrchestrationServiceName .../g,'').
25-
replace(/DummyOrchestrationServiceName OrchestrationServiceNames = "DummyOrchestrationServiceName"\n/g,'').
26-
replace(/,DummyOrchestrationServiceName/,'').
27-
replace(/, 'DummyOrchestrationServiceName'/,'');
26+
replace(/\/\/ (OrchestrationServiceNames)?DummyOrchestrationServiceName .../g,'').
27+
replace(/(OrchestrationServiceNames)?DummyOrchestrationServiceName OrchestrationServiceNames = "DummyOrchestrationServiceName"\n/g,'').
28+
replace(/,(OrchestrationServiceNames)?DummyOrchestrationServiceName/,'').
29+
replace(/, '(OrchestrationServiceNames)?DummyOrchestrationServiceName'/,'');
2830
```
2931
3032
``` yaml $(go) && $(track2)
@@ -35,6 +37,7 @@ output-folder: $(go-sdk-folder)/$(module-name)
3537
azure-arm: true
3638

3739
directive:
40+
# 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
3841
- from: disk.json
3942
where: "$.definitions.PurchasePlan"
4043
transform: >

0 commit comments

Comments
 (0)