Skip to content

Schema titles with commas produce invalid C# identifiers #144

@HavenDV

Description

@HavenDV

Description

When an OpenAPI schema has a title containing commas (or other special characters), AutoSDK uses the title to derive a C# type name and generates an invalid identifier.

Example OpenAPI Schema

EvalItemContentArray:
  title: "Eval item, content, array"
  type: array
  items:
    oneOf:
      - $ref: '#/components/schemas/InputTextContent'
      - $ref: '#/components/schemas/OutputTextContent'

The title "Eval item, content, array" (with commas) gets converted into an invalid C# identifier.

Current Workaround

In FixOpenApiSpec, the title is manually sanitized:

if (openApiDocument.Components.Schemas.TryGetValue("EvalItemContentArray", out var evalItemContentArray)
    && evalItemContentArray is OpenApiSchema evalSchema)
{
    evalSchema.Title = "Eval item content array";
}

Expected Behavior

AutoSDK should sanitize title values when using them to derive C# type/class names. Characters that are invalid in C# identifiers (commas, periods, special chars, etc.) should be stripped or replaced with spaces/underscores before generating the identifier.

Affected SDKs

  • tryAGI/OpenAI (EvalItemContentArray schema has commas in title)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions