AutoSDK
Guides

CLI Commands

Complete reference for all autosdk CLI commands and their options.

The AutoSDK CLI provides commands for generating SDKs, scaffolding projects, and creating test files.

autosdk generate

The primary command — generates a .NET SDK from an OpenAPI or AsyncAPI specification.

autosdk generate <input> [options]

Input can be a local file path or URL to an OpenAPI/AsyncAPI spec (JSON or YAML).

Common Options

OptionDescriptionDefault
--outputOutput directory for generated filesGenerated
--namespaceC# namespace for generated codeDerived from project
--clientClassNameName of the generated client classApi
--targetFrameworkTarget framework (e.g., net10.0)From project
--single-fileGenerate all code in a single filefalse
--exclude-deprecated-operationsSkip deprecated API operationsfalse
--namespace-delimiterSplit dotted component schema IDs into nested namespaces""

Security Options

OptionDescription
--security-schemeAuth scheme in Type:Location:Name format (repeatable)
--base-urlInject a base URL into the spec

Naming Options

OptionDescriptionDefault
--methodNamingConventionHow method names are generatedSimpleOperationId

Available conventions:

  • SimpleOperationId — Uses the operationId directly: listPets becomes ListPets
  • MethodAndPath — Combines HTTP method and path: GET /pets/{id} becomes GetPetById
  • OperationIdWithDots — Preserves dots as namespace separators

AsyncAPI Options

OptionDescription
--websocket-class-nameOverride WebSocket client class name
--types-namespaceReference types from another namespace (cross-namespace refs)
--generate-modelsWhether to generate model classes (true/false)
--json-serializer-contextOverride the generated JsonSerializerContext class name

Dotted Schema IDs as Namespaces

Use --namespace-delimiter when your component schema IDs encode logical namespaces.

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

With this enabled:

  • PetStore.Pet becomes namespace G.PetStore with class Pet
  • Foo.User and Bar.User can both keep the class name User because collisions are resolved per generated namespace
  • --include-models and --exclude-models still match the raw schema IDs from the spec, such as PetStore.Pet

If you exclude a dotted model, choose how references are emitted:

autosdk generate openapi.yaml \
  --namespace G \
  --namespace-delimiter . \
  --exclude-models PetStore.Pet \
  --excluded-model-namespace-mode External
  • External emits global::PetStore.Pet
  • SdkRoot emits global::G.PetStore.Pet

See CLI Options Reference for every flag.

autosdk init

Scaffolds a complete SDK project with solution, tests, CI workflows, and docs.

autosdk init <solution-name> <client-name> <openapi-spec> <company> [options]

Options

OptionDescription
--add-mkdocsInclude MkDocs Material documentation site
--add-testsInclude MSTest integration test project

Example

autosdk init MyApi MyApiClient \
  "https://api.example.com/openapi.json" \
  MyCompany \
  --add-mkdocs --add-tests

autosdk http

Generates .http test files from an OpenAPI spec for use with VS Code REST Client or JetBrains HTTP Client.

autosdk http <input> [options]

autosdk ai spec-from-docs

Uses AI to generate an OpenAPI spec from API documentation pages (experimental).

autosdk ai spec-from-docs <url>
Edit on GitHub

Last updated on

On this page