From 52fd5807e6e7febb4d7ab07aea07e3cac6643f4f Mon Sep 17 00:00:00 2001 From: Jonny Saunders Date: Mon, 8 Jul 2024 21:05:44 -0700 Subject: [PATCH] Make field validators classmethods --- src/curies/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/curies/api.py b/src/curies/api.py index cc0acef..067a3e4 100644 --- a/src/curies/api.py +++ b/src/curies/api.py @@ -275,6 +275,7 @@ class Record(BaseModel): # type:ignore ) @field_validator("prefix_synonyms") # type:ignore + @classmethod def prefix_not_in_synonyms(cls, v: str, values: Mapping[str, Any]) -> str: # noqa:N805 """Check that the canonical prefix does not apper in the prefix synonym list.""" prefix = get_field_validator_values(values, "prefix") @@ -283,6 +284,7 @@ def prefix_not_in_synonyms(cls, v: str, values: Mapping[str, Any]) -> str: # no return v @field_validator("uri_prefix_synonyms") # type:ignore + @classmethod def uri_prefix_not_in_synonyms(cls, v: str, values: Mapping[str, Any]) -> str: # noqa:N805 """Check that the canonical URI prefix does not apper in the URI prefix synonym list.""" uri_prefix = get_field_validator_values(values, "uri_prefix")