Skip to content

Warning usando Pydantic V2 #180

Description

@Mexflubber
../usr/local/lib/python3.11/site-packages/pydantic/fields.py:1093
  /usr/local/lib/python3.11/site-packages/pydantic/fields.py:1093: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'strip_whitespace'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/
    warn(

Esto es ocasionado por el "strip_whitespace=True" dentro de

class BankConfigRequest(BaseModel):
    """
    Validates and processes bank configuration requests.

    The class handles validation of bank names and codes, ensuring:
    - Bank names are non-empty strings
    - Banxico codes are exactly 5 digits
    """

    bank_name: str = Field(
        min_length=1,
        strip_whitespace=True,
        description="Bank name must have at least 1 character.",
    )

    bank_code_banxico: str = Field(
        pattern=r"^\d{5}$",
        description="Banxico code must be a 5-digit string.",
    )

    @property
    def bank_code_abm(self):
        return self.bank_code_banxico[-3:]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions