Index of AutoRest Flags

September 4, 2024 · View on GitHub

Output Verbosity

OptionDescription
--verboseshow verbose output information
--debugshow internal debug information
--quietsuppress output

Managing the installed/used AutoRest version

OptionDescription
--list-installedshow all installed versions of AutoRest tools
--list-available=nnlists the last nn releases available from github (defaults to 10)
--version=versionuses version of AutoRest (installing if necessary.)
--resetremove all installed versions of AutoRest tools and install the latest (override with --version)
--useSpecify an extension to load and use. Format: --use=<packagename>[@<version>] (e.g. --use=@autorest/modelerfour@~4.19.0)

Autorest flags

Those are flags that affect autorest only

FlagDescription
--output-converted-oai3If enabled and the input-files are swagger 2.0 this will output the resulting OpenAPI3.0 converted files to the output-folder
--apply-transforms-in-placeWhen enable right after loading the input files, running the transform directives it will save the resulting OpenAPI value. This can be used to write a transform to permanently modify the swagger.
--memoryConfigure the max memory allowed to the autorest core process. Usage: --memory=8g or --memory=8192m (to set to 8gb)

Validation

Option                     Description
--azure-validatorIf set, runs the Azure specific validator plugin.
--openapi-type=arm│default│data-planeIndicates the type of configuration file being passed to the azure-validator so that it can run the appropriate class of validation rules accordingly.
--skip-semantics-validationDisable the semantic validator plugin.

Shared Flags

FlagDescriptionPython.NETJavaTSGo
--input-file=FILENAMEAdds the given file to the list of input files for generation processxxxxx
--output-folder=DIRECTORYThe location for generated files. If not specified, uses ./generated as the defaultxxxxx
--clear-output-folderClear all contents from our output folder before outputting your newly generated code into that folder. Defaults to false.xxxxx
--project-folder=DIRECTORYUse this flag if you have a project folder that will contain both generated code and existing code you would like to persist. You can then define the output folder relative to this project folder, i.e. output-folder: $(project-folder)/generated.xxxxx
--add-credentialIf specified, the generated client will require a credential to make network calls. See our language docs for information on how to authenticate to our generated clients. Forced to be true if --azure-arm is set, otherwise defaults to false.xNo flag for --add-credential, will add credential param for a TokenCredential if --azure-arm is true.No flag for --add-credential, gets whether to add credential from value of --credential-types. Defaults to false.Is called --add-credentials. Defaults to true.No flag, looks in authenticationRequired field in the swagger. Does not automatically set to true in azure-arm.
--credential-scopes=VALUE(S)Specify the scopes over which the credential functions (see previous flag --add-credential for adding client credentials). This is tied with BearerTokenCredentialPolicy. If generating management plane code (see --azure-arm flag directly below), we default the scope to 'https://management.azure.com/.default'. If not, we highly recommend you use this flag if --add-credential is specified. If you don't generate with scopes in this case, it forces your SDK users to pass credential scopes themselves when calling your code. You can pass multiple values in using CSV format.xNo flag for credential scopes. Currently only sets TokenCredential in mgmt mode. In mgmt mode's case, the credential scope is forced to {endpoint}/.default. In mgmt mode, this endpoint (which is gotten from the swagger), is https://management.azure.comCurrently doesn't default to ARM scope in mgmt mode--credential-scope
--license-header=LICENSE_HEADERSpecify the type of license header for your files. Common values include MICROSOFT_MIT_NO_VERSION and MICROSOFT_MIT_NO_CODEGEN TODO: list of all possible values and defaultxxxxx
--namespace=NAMESPACESets the namespace to use for the generated codexxx
--tag=VALUEPreferred way to have conditional configurations. I.e., in my configuration file, I can set the input-file equal to different values depending on the VALUE passed through the tag flag. See our Adding Tags When Generating section for more information
--azure-armgenerates control plane (Azure Resource Manager) code. Use this if you're generate SDKs for people to manage their Azure resources. See our mgmt plane section for more info. Defaults to false.xxxxUses flag --openapi-type=arm to specify
--head-as-booleanWith this flag, HEAD calls to non-existent resources (404) will not raise an error. Instead, if the resource exists, we return true, else false. Forced to be true if --azure-arm is set, otherwise defaults to false.xxGo default is always false.
--title=NAMEOverride the service client's name listed in the swagger under title.xxxxx
--override-client-name=NAMEName to use for the generated client type. By default, uses the value of the 'Title' field from the input filesxxxxx
--description=DESCRIPTIONOverride the service client's description listed in the swagger under the top level description.xxxxx
--client-side-validationWhether you want the SDK to perform validation on inputs and outputs, based on swagger information. Recommended to be false for track 2 code, since we want the network to validate instead. Defaults to false.xxcalls it --client-side-validationsx
--package-name=NAMEThe name of your package. This is the name your package will be published under.xx
--package-version=VERSIONThe semantic versioning of your generated SDK (i.e., 1.0.0). Not to be confused with the version of the service you're creating an SDK for. If no version is specified, AutoRest will not create a new version file. Generally not necessary if you are going to wrap the generated code before exposing to users.Needs to be specified if --basic-setup-py is specified.Currently can't generate version for track 2Default is 1.0.0-beta.1. Only available in fluent mode.Currently can't set version for track 2Defaults to 1.0.0
--traceWhether to natively support tracing libraries, such OpenCensus or OpenTelemetry. See this tracing quickstart for an overview. Defaults to false.xx
--eolConfigure the line endings for generated files. Options: default, lf, crlfxxxxx

Autorest flags

Those are flags that affect autorest only

FlagDescription
--useSpecify an extension to load and use. Format: --use=<packagename>[@<version>] (e.g. --use=@autorest/modelerfour@~4.19.0)
--output-converted-oai3If enabled and the input-files are swagger 2.0 this will output the resulting OpenAPI3.0 converted files to the output-folder
--skip-semantics-validationDisable the semantic validator plugin.
--memoryConfigure the max memory allowed to the autorest core process. Usage: --memory=8g or --memory=8192m (to set to 8gb)

Temporary flags

Those flags are temporary and will be removed in the future. Those flags are here to have a smoother rollout of certain feature.

FlagDescription

Python Flags

FlagDescription
--python-sdks-folder=DIRECTORYThe path to the root directory of your azure-sdk-for-python clone. Be sure to note that we include sdk in the folder path.
--blackRuns black formatting on your generated files. Defaults to false.
--basic-setup-pyWhether to generate a build script for setuptools to package your SDK. See here for more information about a setup.py file. Defaults to false, generally not suggested if you are going to wrap the generated code before exposing to users. Needs --package-version to be specified. Defaults to false.
--multiapiWhether to generate a multiapi client. See our multiapi section for more information. Defaults to false.
--default-api=VALUEIn the case of --multiapi, you can override the default service API version with this flag. If not specified, we use the latest GA service version as the default API.
--keep-version-fileWhether you want to override the current version file in your package or not. Defaults to false.
--no-namespace-foldersSpecify if you don't want pkgutil-style namespace folders. See here for more information on pkgutil namespace folders. Defaults to false.
--credential-default-policy-type=BearerTokenCredentialPolicy|AzureKeyCredentialPolicySpecify the default credential policy (authentication policy) for your client. Use in conjunction with --add-credential. Currently only supports BearerTokenCredentialPolicy and AzureKeyCredentialPolicy. Default value is BearerTokenCredentialPolicy. --credential-scopes is tied with BearerTokenCredentialPolicy, do not pass them in if you want AzureKeyCredentialPolicy.
--credential-key-header-name=NAMEThe name of the header which will pass the credential. Use if you have --credential-default-policy-type set to AzureKeyCredentialPolicy. For example, if generating cognitive services code, you might use --credential-key-header-name=Ocp-Apim-Subscription-Key.
--python3-onlyWhether to generate only Python3 compatible code. Defaults to true for version-tolerant and low-level-client generations, otherwise false. As azure-sdk-for-python is dropping support for Python 2.7, you should consider generating with this flag set to true for better Python experiences for your users.
--combine-operation-filesWhether you want to combine all of the operation group files into one file (one for sync and one for async). Defaults to true for version-tolerant, false for current generation
--add-python3-operation-filesWhether you want to add python3 typed sync operation files. Defaults to true for version-tolerants and python3-only generations.
--only-path-and-body-parameters-positionalWhether you want to make all non-path and non-body parameters in your methods keyword-only. Defaults to true for version-tolerant generations.
--default-optional-constants-to-noneWhether you want to default optional constant parameters to None. Defaults to true for version-tolerant or low-level-client generations, otherwise 'false'.

Provisional Flags

The flags listed here are still provisional. Code generated with these flags can be subject to change.

FlagDescription
--version-tolerantWhether you want to generate with our newer generator. The goal of this generator's generated code is to be more Pythonic, and to be tolerant to non-breaking version changes on the service side. This flag is still in preview, defaults to false.
--low-level-clientWhether you want to generate an SDK with only request builders and a send_request method on the client. Defaults to false.
--models-mode=msrest|noneWhether you want models for your SDK or not. Currently we only generate msrest models if models are wanted. Defaults to msrest for current AutoRest generation, and none for low-level-client and version-tolerant generations.
--show-send-requestWhether you want the send_request method on your client to be public or not. Defaults to true for version-tolerant and low-level-client generations.
--builders-visibility=public|hidden|embeddedHow visible you want your request builders to be. With public, you get a public rest layer with your request builders. With private, you still get a separate layer with your request builders, but it is hidden. Finally, with embedded, you get the builders embedded in your operations files. Defaults to public for low-level-client, embedded for others.
--show-operationsWhether to generate operations for your client and operation groups. Defaults to true for non-low-level-client generations.

.NET Flags

FlagDescription
--library-name=NAMEThe name of your library. This is what will be displayed on NuGet.
--shared-source-folders=VALUE(S)Pass shared folder paths through here. Common values point to the shared generator assets and shared azure core assets in autorest.csharp
--public-clientsWhether to have your client public. Defaults to false.
--model-namespaceWhether to add a separate namespace of Models, more specifically adding {value-from-namespace-flag}.Models. Defaults to true.

Java Flags

FlagDescription
--java-sdks-folder=DIRECTORYThe path to the root directory of your azure-sdk-for-java clone. Be sure to note that we include sdk in the folder path.
--fluent=LITE|PREMIUMEnables Java's fluent generator, generating a set of fluent Java interfaces for a guided and convenient user experience for the client library. Currently used by Azure management libraries. LITE for Fluent Lite; PREMIUM for Fluent Premium. Default is PREMIUM if provided as other values. See the java docs for all of the Fluent specific flags.
--data-planeEnables Java's DPG, generating a minimal data-plane client. See the java docs for details.
--regenerate-pomWhether to regenerate the pom file in your project. See here for more information on what a pom file is. Defaults to false.
--generate-client-as-implAppend "Impl" to the names of service clients and method groups and place them in the implementation sub-package. Defaults to false.
--generate-client-interfacesGenerates interfaces for all the "Impl"s. Forces --generate-client-as-impl to true, and generates an interface for it as well. Defaults to false.
--generate-sync-async-clientsGenerates sync and async convenience layer clients for all the "Impl"s. Forces --generate-client-as-impl to true. Defaults to false.
--implementation-subpackage=NAMEThe sub-package that the Service client and Method Group client implementation classes will be put into. Defaults to implementation.
--models-subpackage=NAMEThe sub-package that Enums, Exceptions, and Model types will be put into. Defaults to models.
--add-context-parameterIndicates whether the com.azure.core.util.Context parameter should be included in generated proxy methods. Use if you want to pass arbitrary data (key-value pairs) to pipeline policies. Defaults to false.
--context-client-method-parameterIndicates whether the com.azure.core.util.Context parameter should also be included in generated client methods. Forces --add-context-parameter to true. Defaults to false.
--sync-methods=all|essential|noneSpecifies mode for generating sync wrappers. Supported values are
  essential - generates only one sync returning body or header (default)
  all - generates one sync method for each async method
  none - does not generate any sync methods
--required-parameter-client-methodsIndicates whether client method overloads with only required parameters should be generated. Defaults to false.
--custom-types-subpackage=NAMEThe sub-package that the custom types should be generated in. The types that custom types reference, or inherit from will also be automatically moved to this sub-package. Recommended usage: You can set this value to models and set --models-subpackage=implementation.modelsto generate models to implementation.models by default and pick specific models to be public through --custom-types.
--custom-types=NAME(S)Specifies a list of files to put in the package specified in --custom-types-subpackage. You can pass multiple values in using CSV format.
--client-type-prefix=PREFIXThe prefix that will be added to each generated client type.
--model-override-setter-from-superclassIndicates whether to override the superclass setter method in model. Defaults to false. Recommended usage: Set to true.
--non-null-annotationsWhether or not to add the @NotNull annotation to required parameters in client methods. Defaults to false.
--client-loggerWhether the client should log by default. Defaults to false.
--required-fields-as-ctor-argsWhether an object's required fields should be specified as arguments to its constructor. Defaults to false.
--service-interface-as-publicWhether the service's interface should be set as public. Defaults to false.
--artifact-id=NAMEThe name of your project jar without its version. See here for more information about an artifact id.
--pollingThe configuration on the generation of long running operations. See the java docs for details.
--default-http-exception-type=NAMEThe fully-qualified class name that should be used as the default HTTP exception type. The class must extend from HttpResponseException.
--use-default-http-status-code-to-exception-type-mappingIndicates whether a default HTTP status code to exception mapping should be used if one isn't provided. Defaults to false. Recommended usage: Set to true.
--http-status-code-to-exception-type-mappingThe HTTP status code to exception mapping that should be used. All exception types must be fully-qualified and extend from HttpResponseException. See the java docs for details.
--custom-strongly-typed-header-deserializationIndicates whether strongly-typed HTTP header objects will use custom desrialization instead of Jackson Databind's convertValue method, providing substantial performance benefits. Defaults to false. Recommended usage: Set to true.
--generic-response-typeIndicates that generic response types are used instead of named response types that extend the generic type. Defaults to false.
--customization-jar-path=FILEPATHPass in the path to your .jar file that contains customizations to the output files. This will allow AutoRest to dynamically load the class you provide in --customization-class.
--customization-class=NAMEUse in conjunction with --customization-jar-path. That flag tells AutoRest where to look for your custom class, while --customization-class tells AutoRest the name of your custom class.
--skip-formattingIndicates whether to skip formatting Java file. Defaults to false. Recommended usage: Set to true for diagnosis, when AutoRest fails due to syntax error in generated Java code.

TypeScript Flags

FlagDescription
--source-code-folder-path=DIRECTORYWhere to output the generated code inside the output-folder. Use in the scenario when you are going to write a convenience layer on top of the generated code. Defaults to src.x
--generate-metadataWhether to generate extra metadata in your package. For instance, generates a README file, license file etc if set to true. Defaults to false.
--tracing-spanprefix=SPAN_PREFIXIf you are tracing (passing in flag --trace), and you want to overwrite the span prefix AutoRest assigns, use this flag.
--disable-async-iteratorsWhether to generate pageable methods as AsyncIterators. Defaults to true.

Go flags

FlagDescription
--module=NAMEThe name of the module. This is the name your module will be published under.
--file-prefix=PREFIXOptional prefix to file names. For example, if you set your file prefix to "zzz", all generated code files will begin with "zzz".
--openapi-type=arm|data-planeSpecify if you want to generate data-plane code or arm code.

Swift flags

FlagDescription
--generate-as-internal="NAME=ALIAS,NAME=ALIAS..."Rename generated classes to the provided alias and mark them as internal. Can be used on models, clients, and enumerations.

Debugging flags

FlagDescriptionPython.NETJavaTSGo
--verboseLog verbose-level information during generation timexxxxx
--debugLog debug-level information during generation timexxxxx
--{language-generator}-debuggerDebug into a specific language's code. See our debugging docs to see if there are extra steps needed to for your language generator of choicexxxxx
--save-inputsWhether to save the configuration files (i.e. Configuration.json or codeyaml.json). Defaults to false.x
FlagDescriptionPython.NETJavaTSGo
--payload-flattening-threshold=NUMBERThe maximum number of properties in the request body. If the number of properties in the request body is less than or equal to this value, these properties will be represented as method arguments. Not recommended because it can cause surprise breaking changes when adding properties.xxxxx
--add-credentialsSame as flag --add-credential, renamed because we only add one credential param in this case.xxxxx