Skip to content

Bug: serialize Python request models with Swagger JSON property names #60

Description

@daviburg

Problem

The Python SDK correctly uses snake_case public model attributes, but ConnectorHttpClient.send_async serializes dataclass bodies using dataclasses.asdict. That emits Python attribute names instead of the JSON property names declared by the connector Swagger schema.

For example, a Swagger property printBackground is represented by Python print_background. asdict sends print_background, while the generated .NET model sends printBackground through JsonPropertyName. The connector service contract is the Swagger JSON name. Language-specific public naming must not alter the payload wire format.

Evidence

Expected Fix

  1. Preserve idiomatic Python snake_case public attributes and methods.
  2. Generate or retain Swagger JSON property names as serialization metadata.
  3. Replace bare asdict request serialization with a shared recursive wire serializer that emits Swagger property names for dataclasses, nested models, lists, maps, and additional_properties.
  4. Preserve omitted None values and raw bytes request handling.

Regression Coverage

Add shared-runtime tests that capture the exact transport body for a snake_case property with a camelCase Swagger wire name, nested dataclasses and lists, additional_properties, omitted None values, and raw bytes. Add a generated-client contract test using PDF.co HtmlToPdfInput that verifies print_background emits printBackground and paper_size emits paperSize.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions