-
Notifications
You must be signed in to change notification settings - Fork 43
Trying out the track 2 code generator
We're working on a new code generator that's compliant with the Azure SDK Design Guidelines for Go. This is a new codebase, written in TypeScript.
While some concepts and constructs are similar to track 1 generated code, it is not a drop-in replacement.
- npm install -g autorest
The track 2 generator requires autorest.core v3 >= 3.0.6258. If you already have autorest installed, please perform an autorest --reset
which should update you to the latest version.
Preview and GA builds are also published on https://www.npmjs.com/package/@autorest/go.
--use=@autorest/go@4.0.0-preview.22
Below shows an example command for generating a track 2 data-plane client.
autorest --use=@autorest/go@4.0.0-preview.22 --input-file="<path to swagger>" --file-prefix="zz_generated_" --license-header=MICROSOFT_MIT_NO_VERSION --output-folder=<output folder path> --security=AADToken --security-scopes="<data-plane credential scopes>" --module=<module name> --openapi-type="data-plane"
The --file-prefix
switch is an optional switch to add a prefix to all generated files. This is useful when the complete package contains a mix of hand-written and generated code files.
The --module
switch contains the module identity written in your go.mod file. Omit the switch to skip generating a go.mod file.
Note that when generating exported clients, only AADToken
authentication is supported via securityDefinitions at this time.