AutoSDK
Reference

CLI Options Reference

Complete reference for every autosdk generate flag and option.

Complete reference for all autosdk generate command options.

Usage

autosdk generate <input> [options]

<input> — Path or URL to an OpenAPI 3.0/3.1 or AsyncAPI 2.x specification (JSON or YAML).

Core Options

OptionTypeDefaultDescription
--outputstringGeneratedOutput directory for generated files
--namespacestringFrom projectC# namespace for all generated types
--clientClassNamestringApiName of the generated HTTP client class
--targetFrameworkstringFrom projectTarget framework (e.g., net10.0, netstandard2.0)
--single-fileboolfalseGenerate all code in a single file

Security Options

OptionTypeDefaultDescription
--security-schemestringAuth scheme (repeatable). Format: Type:Location:Name
--base-urlstringInject server URL into the spec

Security Scheme Format

Type:Location:Name where:

  • Type: ApiKey or Http
  • Location: Header, Query, or Cookie
  • Name: Parameter name or auth scheme (Bearer, Basic)

Examples:

--security-scheme Http:Header:Bearer        # Bearer token
--security-scheme ApiKey:Header:x-api-key   # API key in header
--security-scheme ApiKey:Query:api_key       # API key in query string
--security-scheme Http:Header:Basic          # Basic auth

Naming Options

OptionTypeDefaultDescription
--methodNamingConventionenumSimpleOperationIdMethod naming strategy
--methodNamingConventionFallbackenumMethodAndPathFallback when operationId missing
--useExtensionNamingboolfalseUse x-fern-sdk-group-name/x-fern-sdk-method-name

Method naming conventions: SimpleOperationId, MethodAndPath, OperationIdWithDots

Filtering Options

OptionTypeDefaultDescription
--exclude-deprecated-operationsboolfalseSkip deprecated operations
--include-modelsstring[]Only generate these component schema IDs. Repeatable or pass multiple values
--exclude-modelsstring[]Skip these component schema IDs. Repeatable or pass multiple values

When model filtering is enabled, AutoSDK matches the raw component IDs from the specification. For example, if your schema is named PetStore.Pet, use --include-models PetStore.Pet or --exclude-models PetStore.Pet.

Model Options

OptionTypeDefaultDescription
--modelStyleenumClassModel code style: Class, Record, ReadonlyRecordStruct
--validationboolfalseGenerate validation methods on models
--compute-discriminatorsboolfalseAuto-detect oneOf/anyOf discriminators
--namespace-delimiterstring""Optional single-character delimiter for splitting dotted component schema IDs into namespaces
--excluded-model-namespace-modeenumExternalHow excluded dotted models are referenced when --namespace-delimiter is enabled: External or SdkRoot

Dotted Schema Namespace Example

autosdk generate openapi.yaml \
  --namespace G \
  --namespace-delimiter .

With the delimiter enabled:

  • PetStore.Pet generates namespace G.PetStore with class Pet
  • System.Text.Json.Nodes.JsonObject generates namespace G.System.Text.Json.Nodes with class JsonObject
  • --exclude-models PetStore.Pet still matches the raw schema ID exactly

If you also exclude a dotted model, --excluded-model-namespace-mode controls the reference target:

  • External -> global::PetStore.Pet
  • SdkRoot -> global::G.PetStore.Pet

JSON Options

OptionTypeDefaultDescription
--json-serializer-typeenumSystemTextJsonSerializer: SystemTextJson or NewtonsoftJson
--json-serializer-contextstringReference existing JsonSerializerContext

AsyncAPI / WebSocket Options

OptionTypeDefaultDescription
--websocket-class-namestringAutoOverride WebSocket client class name
--types-namespacestringReference types from another namespace
--generate-modelsbooltrueWhether to generate model classes
--json-serializer-contextstringSourceGenerationContextOverride the generated JsonSerializerContext class name

Code Generation Options

OptionTypeDefaultDescription
--generate-polyfillsbooltrueGenerate framework compatibility shims
--generate-exceptionsbooltrueGenerate exception types
--generate-cliboolfalseGenerate CLI wrapper for the SDK
--group-by-tagsboolfalseGroup operations by OpenAPI tags

Error Handling

OptionTypeDefaultDescription
--ignore-openapi-errorsbooltrueContinue on spec parse errors
--ignore-openapi-warningsbooltrueSuppress spec warnings
Edit on GitHub

Last updated on

On this page