Skip to content

Working with AutoRest

Jonathan Giles edited this page Jun 22, 2020 · 8 revisions

AutoRest is the name of the tool we use to generate the communication layer that lies beneath the API we expose to our users. AutoRest saves us from having to write a lot of network communication code, and instead we can direct our focus towards building a great user experience on top of this generated code. Our goal should be to expose as little, and ideally none, of the generated code to the user.

Getting started with AutoRest is as simple as following these steps:

  1. Fork and clone this GitHub repo and switch to the "v4" branch.
  2. Run git submodule update --init --recursive to get azure-common.
  3. Run npm install. You need v10 version of Node.JS installed.
  4. Run npm install -g autorest.
  5. Run AutoRest commands like this:
autorest --java --use=C:\work\autorest.java\ C:\swagger\updated\Blob\readme.md --output-folder=C:\work\azure-sdk-for-java\storage\client\ --namespace=com.azure.storage.blob --sync-methods=none --generate-client-interfaces=false --enable-xml --required-parameter-client-methods

Notes:

  1. --use=<path to your autorest.java clone>
  2. If the input is a JSON spec, use --input-file=<local path of URL of JSON file>, if it's a README.md file, remove --input-file=
  3. --enable-xml --required-parameter-client-methods are not needed for services other than Storage
Clone this wiki locally