AutoSDK
Guides

OpenAPI Extensions

Vendor extensions (x-* properties) supported by AutoSDK for enhanced generation.

AutoSDK supports several vendor extensions (x-* properties) in OpenAPI specs to improve the quality of generated code.

x-enum-varnames

Provides human-readable names for enum values:

components:
  schemas:
    Status:
      type: string
      enum: ["active", "inactive", "pending_review"]
      x-enum-varnames: ["Active", "Inactive", "PendingReview"]

Generated C#:

public enum Status
{
    Active,
    Inactive,
    PendingReview,
}

Without x-enum-varnames, AutoSDK infers names by PascalCase-converting the raw values.

x-fern-sdk-group-name / x-fern-sdk-method-name

Used by APIs that publish via Fern. AutoSDK reads these when --useExtensionNaming (or AutoSDK_UseExtensionNaming=true) is enabled:

paths:
  /chat/completions:
    post:
      x-fern-sdk-group-name: chat
      x-fern-sdk-method-name: complete

This generates client.Chat.CompleteAsync() instead of using the operationId.

Enable with:

autosdk generate spec.yaml --useExtensionNaming

x-fern-ignore

Mark operations to be skipped during generation:

paths:
  /internal/debug:
    get:
      x-fern-ignore: true

Custom Discriminators

For oneOf/anyOf schemas, AutoSDK can compute discriminators automatically:

autosdk generate spec.yaml --compute-discriminators

This analyzes the schema structure and generates proper discriminated union types with JSON converters.

Spec Patching

When a spec doesn't include extensions, patch them in your generate.sh:

# Add x-enum-varnames via jq
cat openapi.json | jq '
  .components.schemas.Status["x-enum-varnames"] = ["Active", "Inactive"]
' > patched.json

autosdk generate patched.json --output Generated

See Customization for more patching patterns.

Edit on GitHub

Last updated on

On this page