
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
@azure-tools/typespec-autorest
Advanced tools
TypeSpec library for emitting openapi from the TypeSpec REST protocol binding
TypeSpec library for emitting openapi from the TypeSpec REST protocol binding
npm install @azure-tools/typespec-autorest
tsp compile . --emit=@azure-tools/typespec-autorest
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: value
emitter-output-dirType: absolutePath
Defines the emitter output directory. Defaults to {output-dir}/@azure-tools/typespec-autorest
See Configuring output directory for more info
output-dirType: string
Deprecated DO NOT USE. Use built-in emitter-output-dir instead
output-fileType: string
Name of the output file. Output file will interpolate the following values:
preview if version contains preview, stable otherwise.Default: {azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json
Example: Single service no versioning
openapi.yamlExample: Multiple services no versioning
openapi.Org1.Service1.yamlopenapi.Org1.Service2.yamlExample: Single service with versioning
openapi.v1.yamlopenapi.v2.yamlExample: Multiple service with versioning
openapi.Org1.Service1.v1.yamlopenapi.Org1.Service1.v2.yamlopenapi.Org1.Service2.v1.0.yamlopenapi.Org1.Service2.v1.1.yamlExample: azureResourceProviderFolder is provided
arm-folder/AzureService/preview/2020-01-01.yamlarm-folder/AzureService/preview/2020-01-01.yamlexamples-dirType: string
Directory where the examples are located. Default: {project-root}/examples.
examples-directoryType: string
DEPRECATED. Use examples-dir instead
versionType: string
azure-resource-provider-folderType: string
arm-types-dirType: string
Path to the common-types.json file folder. Default: '${project-root}/../../common-types/resource-management'
new-lineType: "crlf" | "lf"
Set the newline character for emitting files.
omit-unreachable-typesType: 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-strategyType: string
Decide how to deal with the Version enum when when omit-unreachable-types is not set. Default to 'omit'
include-x-typespec-nameType: "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-schemaType: boolean
Create read-only property schema for lro status
emit-lro-optionsType: "none" | "final-state-only" | "all"
Determine whether and how to emit x-ms-long-running-operation-options for lro resolution
arm-resource-flatteningType: boolean
Back-compat flag. If true, continue to emit x-ms-client-flatten in for some of the ARM resource properties.
emit-common-types-schemaType: "never" | "for-visibility-changes"
Determine whether and how to emit schemas for common-types rather than referencing them
xml-strategyType: "xml-service" | "none"
Strategy for applying XML serialization metadata to schemas.
@example@example - attaches example files to an operation. Multiple examples can be specified.
@example can be specified on Operations.
@Autorest.example(pathOrUri: valueof string, title: valueof string)
Operation
| Name | Type | Description |
|---|---|---|
| pathOrUri | valueof string | path or Uri to the example file. |
| title | valueof string | name or description of the example file. |
@useRef@useRef - is used to replace the TypeSpec model type in emitter output with a pre-existing named OpenAPI schema such as Azure Resource Manager common types.
@useRef can be specified on Models and ModelProperty.
@Autorest.useRef(jsonRef: valueof string)
Model | ModelProperty
| Name | Type | Description |
|---|---|---|
| jsonRef | valueof string | path or Uri to an OpenAPI schema. |
FAQs
TypeSpec library for emitting openapi from the TypeSpec REST protocol binding
The npm package @azure-tools/typespec-autorest receives a total of 38,826 weekly downloads. As such, @azure-tools/typespec-autorest popularity was classified as popular.
We found that @azure-tools/typespec-autorest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies