pydantic / bump-pydantic

Convert Pydantic from V1 to V2 ♻
MIT License
303 stars 24 forks source link

Processing extra fields #147

Open denisart opened 6 months ago

denisart commented 6 months ago

Problem

bump-pydantic doesn't change when i using extra fields in pydantic.Field. Simple example:

# my code
from pydantic import BaseModel, Field

class Human(BaseModel):
    name: str = Field(..., min_length=1, some_extra_field="some_extra_field_value")
# expected code
from pydantic import BaseModel, Field

class Human(BaseModel):
    name: str = Field(..., min_length=1, json_schema_extra={"some_extra_field": "some_extra_field_value"})

Plus refactor with running black bump_pydantic