Skip to content

Generating with autorest for Typescript v6

Jose Manuel Heredia Hidalgo edited this page Nov 20, 2020 · 16 revisions

Install autorest v3

  • npm install -g autorest

Generate

Make sure to do an "autorest --reset" if you don't have a core v3 >= 3.0.6320

You can find the latest (v6) release here.

You must pass --use to the tgz file. Current version at the time of this writing:

--use=@autorest/[email protected]

Or when using a markdown config:

v3: true
use-extension:
  "@autorest/typescript": "6.0.0-dev.20201119.1"

CLI Example:

autorest
--typescript --package-name=@azure/ai-anomaly-detector
--use="@autorest/typescript"@"6.0.0-dev.20201119.1"
--input-file=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/AnomalyDetector/preview/v1.0/AnomalyDetector.json

Config File Example

  • Readme.md
v3: true
package-name: "@azure/ai-anomaly-detector"
title: GeneratedClient
description: AnomalyDetector Client
generate-metadata: false
license-header: MICROSOFT_MIT_NO_VERSION
output-folder: ../
source-code-folder-path: ./src/generated
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/AnomalyDetector/preview/v1.0/AnomalyDetector.json
add-credentials: false
use-extension:
  "@autorest/typescript": "6.0.0-dev.20201119.1"
package-version: "3.0.0-beta.1"

Run in terminal:

autorest Readme.md --typescript