Skip to content

Pydantic alias_generator #2942

@nniccolb

Description

@nniccolb

Describe the Bug

Hi this is a bit of an edge case, but Pydantic Models using alias_generator are not interpreted correctly.

from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel

class Model(BaseModel):
    model_config = ConfigDict(frozen=True, alias_generator=to_camel)
    some_property: str

model1 = Model(some_property="foo") 
model = Model(someProperty="foo")  # Pyrefly error, no runtime error

Error:
Image

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pydanticIssues related to support for Pydantic

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions