Skip to content

Being able to generate the object instead of Any for TypedDict #2729

@hgl

Description

@hgl

Is your feature request related to a problem? Please describe.
Given a json schema that contains { "type": "object" }, it currently generates dict[str, Any], similarly for { "type": "array" }. This makes the generated TypedDict not as type safe.
Describe the solution you'd like
A flag to generate dict[str, object] or `list[object]

Describe alternatives you've considered
Post-processing and custom jinja2 template (using replace) are sledgehammer solutions and very hard to replace perfectly.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions