Skip to content

Emitter usage

  1. Via the command line
Terminal window
tsp compile . --emit=@azure-tools/typespec-java
  1. Via the config
emit:
- "@azure-tools/typespec-java"

The config can be extended with options as follows:

emit:
- "@azure-tools/typespec-java"
options:
"@azure-tools/typespec-java":
option: value

Type: absolutePath

Defines the emitter output directory. Defaults to {output-dir}/@azure-tools/typespec-java See Configuring output directory for more info

Type: string

Specifies the namespace you want to override for namespaces set in the spec. With this config, all namespace for the spec types will default to it.

Type: string

Specify the human readable name of the service. The name will be used in README.md and entry class. This option is for management-plane SDK.

Type: string

Specifies the directory where the emitter will look for example files. If the flag isn’t set, the emitter defaults to using an examples directory located at the project root.

Type: boolean

When set to true, the emitter will generate Java sample code. Default value is true.

Type: boolean

When set to true, the emitter will generate Java test code (mock test for management-plane SDK, disabled live test for data-plane SDK). Default value is true.

Type: boolean

When set to true, the generated SDK uses synchronous REST API invocation. Default value is true. This option is to be deprecated.

Type: boolean

When set to true, the generated SDK uses stream style serialization. Default value is true. This option is to be deprecated.

Type: boolean

When set to true, the emitter generates Java Object for TypeSpec unknown; otherwise, the emitter generates BinaryData. Default value is false. This option is for backward-compatibility.

Type: boolean

When set to true, the emitter will generate low-level protocol methods for each service operation if @protocolAPI is not set for an operation. Default value is true.

Type: boolean

When set to true, the emitter will generate low-level protocol methods for each service operation if @convenientAPI is not set for an operation. Default value is true.

Type: boolean

When set to true, the emitter will merge the generated code with existing code on emitter-output-dir, during post-process. Default value is false.

Type: string

Specify the package name for model classes. Default value is models.

Type: string

Specify the Java class names for custom model classes.

Type: string

Specify the package name for custom model classes.

Type: string

Specify the Java class that to be executed by emitter for code customization, during post-process.

Type: array

Specify headers that emitter will ignore.

Type: boolean

When set to true, the generated SDK uses getter method to access child clients. Default value is false.

Type: string

Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values latest and all.

Type: boolean

When set to true, the emitter will take the history of api-versions in TypeSpec, and try generate SDK without breaking changes compared to SDK generated from prior api-versions. Default value is false. This is an experimental feature.

Type: boolean

When set to true, the emitter will not include ##-preview api-versions in ServiceVersion class. Default value is false. The option should be set to true, if the intended release is SDK of stable version.

Type: object

Developer options for http-client-java emitter.