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
| Option | Description | Default |
|---|---|---|
--output | Output directory for generated files | Generated |
--namespace | C# namespace for generated code | Derived from project |
--clientClassName | Name of the generated client class | Api |
--targetFramework | Target framework (e.g., net10.0) | From project |
--single-file | Generate all code in a single file | false |
--exclude-deprecated-operations | Skip deprecated API operations | false |
--namespace-delimiter | Split dotted component schema IDs into nested namespaces | "" |
Security Options
| Option | Description |
|---|---|
--security-scheme | Auth scheme in Type:Location:Name format (repeatable) |
--base-url | Inject a base URL into the spec |
Naming Options
| Option | Description | Default |
|---|---|---|
--methodNamingConvention | How method names are generated | SimpleOperationId |
Available conventions:
- SimpleOperationId — Uses the
operationIddirectly:listPetsbecomesListPets - MethodAndPath — Combines HTTP method and path:
GET /pets/{id}becomesGetPetById - OperationIdWithDots — Preserves dots as namespace separators
AsyncAPI Options
| Option | Description |
|---|---|
--websocket-class-name | Override WebSocket client class name |
--types-namespace | Reference types from another namespace (cross-namespace refs) |
--generate-models | Whether to generate model classes (true/false) |
--json-serializer-context | Override 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.Petbecomesnamespace G.PetStorewith classPetFoo.UserandBar.Usercan both keep the class nameUserbecause collisions are resolved per generated namespace--include-modelsand--exclude-modelsstill match the raw schema IDs from the spec, such asPetStore.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 ExternalExternalemitsglobal::PetStore.PetSdkRootemitsglobal::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
| Option | Description |
|---|---|
--add-mkdocs | Include MkDocs Material documentation site |
--add-tests | Include MSTest integration test project |
Example
autosdk init MyApi MyApiClient \
"https://api.example.com/openapi.json" \
MyCompany \
--add-mkdocs --add-testsautosdk 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>Last updated on