canonical / traefik-k8s-operator

https://charmhub.io/traefik-k8s
Apache License 2.0
11 stars 26 forks source link

pydantic deprecation warnings #382

Closed dimaqq closed 1 month ago

dimaqq commented 3 months ago

Bug Description

validators generate these warnings when tests are run

To Reproduce

Environment

any

Relevant log output

lib/charms/traefik_k8s/v2/ingress.py:255
  /code/hexanator/lib/charms/traefik_k8s/v2/ingress.py:255: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/
    @validator("scheme", pre=True)

lib/charms/traefik_k8s/v2/ingress.py:262
  /code/hexanator/lib/charms/traefik_k8s/v2/ingress.py:262: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/
    @validator("port", pre=True)

lib/charms/traefik_k8s/v2/ingress.py:280
  /code/hexanator/lib/charms/traefik_k8s/v2/ingress.py:280: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/
    @validator("host", pre=True)

lib/charms/traefik_k8s/v2/ingress.py:286
  /code/hexanator/lib/charms/traefik_k8s/v2/ingress.py:286: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/
    @validator("ip", pre=True)

Additional context

No response

dimaqq commented 3 months ago

upstream doc link: https://docs.pydantic.dev/2.8/migration/#validator-and-root_validator-are-deprecated

lucabello commented 3 months ago

@PietroPasotti

lucabello commented 1 month ago

Closed by https://github.com/canonical/traefik-k8s-operator/pull/388.