Emitter usage
- Via the command line
tsp compile . --emit=@azure-tools/typespec-go
- Via the config
emit: - '@azure-tools/typespec-go'
The config can be extended with options as follows:
emit: - '@azure-tools/typespec-go'options: '@azure-tools/typespec-go': option: value
Emitter options
Section titled âEmitter optionsâemitter-output-dir
Section titled âemitter-output-dirâType: absolutePath
Defines the emitter output directory. Defaults to {output-dir}/@azure-tools/typespec-go
See Configuring output directory for more info
azcore-version
Section titled âazcore-versionâType: string
Semantic version of azcore without the leading âvâ to use if different from the default version (e.g. 1.2.3).
disallow-unknown-fields
Section titled âdisallow-unknown-fieldsâType: boolean
When true, unmarshalers will return an error when an unknown field is encountered in the payload. The default is false.
file-prefix
Section titled âfile-prefixâType: string
Optional prefix to file names. For example, if you set your file prefix to âzzz*â, all generated code files will begin with âzzz*â.
generate-fakes
Section titled âgenerate-fakesâType: boolean
When true, enables generation of fake servers. The default is false.
head-as-boolean
Section titled âhead-as-booleanâType: boolean
When true, HEAD requests will return a boolean value based on the HTTP status code. The default is false.
inject-spans
Section titled âinject-spansâType: boolean
Enables generation of spans for distributed tracing. The default is false.
Type: string
The name of the Go module written to go.mod. Omit to skip go.mod generation. When module is specified, module-version must also be specified.
module-version
Section titled âmodule-versionâType: string
Semantic version of the Go module without the leading âvâ written to constants.go. (e.g. 1.2.3). When module-version is specified, module must also be specified.
rawjson-as-bytes
Section titled ârawjson-as-bytesâType: boolean
When true, properties that are untyped (i.e. raw JSON) are exposed as []byte instead of any or map[string]any. The default is false.
slice-elements-byval
Section titled âslice-elements-byvalâType: boolean
When true, slice elements will not be pointer-to-type. The default is false.
single-client
Section titled âsingle-clientâType: boolean
Indicates package has a single client. This will omit the Client prefix from options and response types. If multiple clients are detected, an error is returned. The default is false.
stutter
Section titled âstutterâType: string
Uses the specified value to remove stuttering from types and funcs instead of the built-in algorithm.
fix-const-stuttering
Section titled âfix-const-stutteringâType: boolean
When true, fix stuttering for const
types and values. The default is false.
generate-examples
Section titled âgenerate-examplesâType: boolean
Deprecated. Use generate-samples instead.
generate-samples
Section titled âgenerate-samplesâType: boolean
When true, generate example tests. The default is false.
factory-gather-all-params
Section titled âfactory-gather-all-paramsâType: boolean
When true, the NewClientFactory
constructor gathers all parameters. When false, it only gathers common parameters of clients. The default is true.