Skip to content

Consider adding snake_case to camelCase conversion for Literal parameter values #700

Description

@vdusek

Summary

Currently, Literal type parameters that map directly to API query parameters use camelCase values, matching the API convention. For example:

sort_by: Literal['createdAt', 'stats.lastRunStartedAt'] | None = 'createdAt'
ownership: Literal['ownedByMe', 'sharedWithMe'] | None = None

This works, but it's not idiomatic Python — users would expect snake_case values in the Python interface.

Proposal

Introduce a conversion mechanism that allows snake_case values in the Python-facing API and converts them to camelCase before sending to the Apify API. For example:

# Python interface
ownership: Literal['owned_by_me', 'shared_with_me'] | None = None

# Converted to `ownedByMe` / `sharedWithMe` in the HTTP request

Context

This was identified during the review of #696 — see this comment.

Should be considered before v3.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions