Emitter usage
Emitter usage
Section titled âEmitter usageâ- Via the command line
tsp compile . --emit=@azure-tools/typespec-autorest- Via the config
emit: - "@azure-tools/typespec-autorest"The config can be extended with options as follows:
emit: - "@azure-tools/typespec-autorest"options: "@azure-tools/typespec-autorest": option: valueEmitter 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-autorest
See Configuring output directory for more info
output-dir
Section titled âoutput-dirâType: string
Deprecated DO NOT USE. Use built-in emitter-output-dir instead
output-file
Section titled âoutput-fileâType: string
Name of the output file. Output file will interpolate the following values:
- service-name: Name of the service if multiple
- version: Version of the service if multiple
- azure-resource-provider-folder: Value of the azure-resource-provider-folder option
- version-status: Only enabled if azure-resource-provider-folder is set.
previewif version contains preview, stable otherwise.
Default: {azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json
Example: Single service no versioning
openapi.yaml
Example: Multiple services no versioning
openapi.Org1.Service1.yamlopenapi.Org1.Service2.yaml
Example: Single service with versioning
openapi.v1.yamlopenapi.v2.yaml
Example: Multiple service with versioning
openapi.Org1.Service1.v1.yamlopenapi.Org1.Service1.v2.yamlopenapi.Org1.Service2.v1.0.yamlopenapi.Org1.Service2.v1.1.yaml
Example: azureResourceProviderFolder is provided
arm-folder/AzureService/preview/2020-01-01.yamlarm-folder/AzureService/preview/2020-01-01.yaml
examples-dir
Section titled âexamples-dirâType: string
Directory where the examples are located. Default: {project-root}/examples.
examples-directory
Section titled âexamples-directoryâType: string
DEPRECATED. Use examples-dir instead
version
Section titled âversionâType: string
azure-resource-provider-folder
Section titled âazure-resource-provider-folderâType: string
arm-types-dir
Section titled âarm-types-dirâType: string
Path to the common-types.json file folder. Default: â${project-root}/../../common-types/resource-managementâ
new-line
Section titled ânew-lineâType: "crlf" | "lf"
Set the newline character for emitting files.
omit-unreachable-types
Section titled âomit-unreachable-typesâType: boolean
Omit unreachable types. By default all types declared under the service namespace will be included. With this flag on only types references in an operation will be emitted.
version-enum-strategy
Section titled âversion-enum-strategyâType: string
Decide how to deal with the Version enum when when omit-unreachable-types is not set. Default to âomitâ
include-x-typespec-name
Section titled âinclude-x-typespec-nameâType: "inline-only" | "never"
If the generated openapi types should have the x-typespec-name extension set with the name of the TypeSpec type that created it.
This extension is meant for debugging and should not be depended on.
use-read-only-status-schema
Section titled âuse-read-only-status-schemaâType: boolean
Create read-only property schema for lro status
emit-lro-options
Section titled âemit-lro-optionsâType: "none" | "final-state-only" | "all"
Determine whether and how to emit x-ms-long-running-operation-options for lro resolution
emit-common-types-schema
Section titled âemit-common-types-schemaâType: "never" | "for-visibility-changes"
Determine whether and how to emit schemas for common-types rather than referencing them
xml-strategy
Section titled âxml-strategyâType: "xml-service" | "none"
Strategy for applying XML serialization metadata to schemas.
output-splitting
Section titled âoutput-splittingâType: "legacy-feature-files"
Determines whether output should be split into multiple files. The only supported option for splitting is âlegacy-feature-filesâ, which uses the typespec-azure-resource-manager @feature decorators to split into output files based on feature.