AutoSDK
Concepts

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 SchemaC# Type
pet_storePetStore
HTTPResponseHttpResponse
create-user-requestCreateUserRequest

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: string

Generates: 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 (from pet)
  • Pet2 (from Pet in a different context)

Method Naming

Three conventions are available via --methodNamingConvention:

SimpleOperationId (Default)

Uses the operationId from the spec, PascalCased:

operationIdC# Method
listPetsListPetsAsync
get_pet_by_idGetPetByIdAsync
createUserCreateUserAsync

MethodAndPath

Combines HTTP method and URL path:

Method + PathC# Method
GET /petsGetPetsAsync
GET /pets/{petId}GetPetsByPetIdAsync
POST /usersPostUsersAsync

OperationIdWithDots

Preserves dots as namespace separators for APIs that use dotted operation IDs:

operationIdC# Method
pets.listPets.ListAsync
users.createUsers.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 ValueC# Member
activeActive
pending_reviewPendingReview
IN_PROGRESSInProgress

CLS-Compliant Prefix

Enum values starting with a digit get a configurable prefix (default: x):

OpenAPI ValueC# Member
3dx3d
404x404

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 ParameterC# Parameter
pet_idpetId
X-API-KeyxApiKey
page_sizepageSize
Edit on GitHub

Last updated on

On this page