Naming Conventions
How AutoSDK generates C# names from OpenAPI schemas and operations.
AutoSDK transforms OpenAPI names into idiomatic C# identifiers. This page explains the naming strategies and how to control them.
Type Naming
OpenAPI schema names are converted to PascalCase C# type names:
| OpenAPI Schema | C# Type |
|---|---|
pet_store | PetStore |
HTTPResponse | HttpResponse |
create-user-request | CreateUserRequest |
Nested Types
When schemas contain inline objects, AutoSDK has two strategies controlled by AutoSDK_NamingConvention:
ConcatNames (default) — Concatenates parent and property names:
Pet:
properties:
owner:
type: object
properties:
name:
type: stringGenerates: PetOwner class
InnerClasses — Uses nested C# classes:
Generates: Pet.Owner class
Collision Resolution
When two schemas would produce the same C# name, AutoSDK appends numeric suffixes:
Pet(frompet)Pet2(fromPetin a different context)
Method Naming
Three conventions are available via --methodNamingConvention:
SimpleOperationId (Default)
Uses the operationId from the spec, PascalCased:
| operationId | C# Method |
|---|---|
listPets | ListPetsAsync |
get_pet_by_id | GetPetByIdAsync |
createUser | CreateUserAsync |
MethodAndPath
Combines HTTP method and URL path:
| Method + Path | C# Method |
|---|---|
GET /pets | GetPetsAsync |
GET /pets/{petId} | GetPetsByPetIdAsync |
POST /users | PostUsersAsync |
OperationIdWithDots
Preserves dots as namespace separators for APIs that use dotted operation IDs:
| operationId | C# Method |
|---|---|
pets.list | Pets.ListAsync |
users.create | Users.CreateAsync |
Fallback
If an operation has no operationId, AutoSDK falls back to MethodAndPath regardless of the configured convention. Control this with --methodNamingConventionFallback.
Enum Naming
Enum members are PascalCased from their string values:
| OpenAPI Value | C# Member |
|---|---|
active | Active |
pending_review | PendingReview |
IN_PROGRESS | InProgress |
CLS-Compliant Prefix
Enum values starting with a digit get a configurable prefix (default: x):
| OpenAPI Value | C# Member |
|---|---|
3d | x3d |
404 | x404 |
Configure with AutoSDK_ClsCompliantEnumPrefix.
x-enum-varnames
Override generated names entirely:
Status:
type: string
enum: ["a", "b", "c"]
x-enum-varnames: ["Active", "Blocked", "Closed"]Parameter Naming
Operation parameters are camelCased for C# method parameters:
| OpenAPI Parameter | C# Parameter |
|---|---|
pet_id | petId |
X-API-Key | xApiKey |
page_size | pageSize |
Last updated on