Skip to content

Commit

Permalink
Fix readme.go.md in compute RP (#14631)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ArcturusZhang authored Aug 2, 2021
1 parent 749d2b5 commit 7a2f167
Showing 1 changed file with 9 additions and 6 deletions.
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
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

0 comments on commit 7a2f167

Please sign in to comment.