Skip to content

Autorest v3 based generator cheatsheet

iscai-msft edited this page Jul 23, 2021 · 13 revisions

Run pure Python on a YAML model

python -m autorest.code_generator code-model-v4-no-tags.yaml

Tests

Starting tests even if some files are not Python valid

pytest --continue-on-collection-errors

No traceback

pytest --continue-on-collection-errors --tb=no

Using autorest

npm install -g "@autorest/autorest"

autorest --use:@autorest/modelerfour@~4.0.9 --output-artifact:code-model-v4-no-tags --input-file:https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/Microsoft.Storage/stable/2019-04-01/storage.json --output-folder=.

Calling mypy from root

mypy --config-file=mypy.ini autorest

VSCode debug

VScode launch configuration

    {
      "name": "Python: Attach",
      "type": "python",
      "request": "attach",
      "port": 5678,
      "host": "localhost"
    }

When autorest is started, it will block automatically when starting the JSON server, waiting for attach from VScode

Release

https://dev.azure.com/azure-sdk/internal/_build?definitionId=1600

npm release: https://dev.azure.com/azure-sdk/internal/_build?definitionId=1668&_a=summary