nucliadb-models 6.4.0.post4224__py3-none-any.whl → 6.4.0.post4241__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nucliadb_models/filters.py +16 -4
- {nucliadb_models-6.4.0.post4224.dist-info → nucliadb_models-6.4.0.post4241.dist-info}/METADATA +1 -1
- {nucliadb_models-6.4.0.post4224.dist-info → nucliadb_models-6.4.0.post4241.dist-info}/RECORD +5 -5
- {nucliadb_models-6.4.0.post4224.dist-info → nucliadb_models-6.4.0.post4241.dist-info}/WHEEL +0 -0
- {nucliadb_models-6.4.0.post4224.dist-info → nucliadb_models-6.4.0.post4241.dist-info}/top_level.txt +0 -0
nucliadb_models/filters.py
CHANGED
@@ -20,14 +20,15 @@
|
|
20
20
|
|
21
21
|
from enum import Enum
|
22
22
|
from typing import Any, Generic, Literal, Optional, TypeVar, Union
|
23
|
+
from uuid import UUID
|
23
24
|
|
24
25
|
import pydantic
|
25
|
-
from pydantic import AliasChoices, BaseModel, Discriminator, Tag, model_validator
|
26
|
+
from pydantic import AliasChoices, BaseModel, Discriminator, Tag, field_validator, model_validator
|
26
27
|
from typing_extensions import Annotated, Self
|
27
28
|
|
28
29
|
from .common import FieldTypeName, Paragraph
|
29
30
|
from .metadata import ResourceProcessingStatus
|
30
|
-
from .utils import DateTime
|
31
|
+
from .utils import DateTime, SlugString
|
31
32
|
|
32
33
|
F = TypeVar("F", bound=BaseModel)
|
33
34
|
|
@@ -72,8 +73,19 @@ class Resource(BaseModel, extra="forbid"):
|
|
72
73
|
"""Matches all fields of a resource given its id or slug"""
|
73
74
|
|
74
75
|
prop: Literal["resource"] = "resource"
|
75
|
-
id: Optional[str] = pydantic.Field(default=None, description="
|
76
|
-
slug: Optional[
|
76
|
+
id: Optional[str] = pydantic.Field(default=None, description="UUID of the resource to match")
|
77
|
+
slug: Optional[SlugString] = pydantic.Field(
|
78
|
+
default=None, description="Slug of the resource to match"
|
79
|
+
)
|
80
|
+
|
81
|
+
@field_validator("id", mode="after")
|
82
|
+
def validate_id(cls, v: str) -> str:
|
83
|
+
if v is not None:
|
84
|
+
try:
|
85
|
+
UUID(v)
|
86
|
+
except ValueError:
|
87
|
+
raise ValueError("Invalid UUID")
|
88
|
+
return v
|
77
89
|
|
78
90
|
@model_validator(mode="after")
|
79
91
|
def single_field(self) -> Self:
|
{nucliadb_models-6.4.0.post4224.dist-info → nucliadb_models-6.4.0.post4241.dist-info}/RECORD
RENAMED
@@ -8,7 +8,7 @@ nucliadb_models/export_import.py,sha256=A1KTjwQCRtyVAWcgabXsdltI78rauXBmZX1ie6Rx
|
|
8
8
|
nucliadb_models/external_index_providers.py,sha256=aVyj-P4kVqfqPjF13E_lUM0FZsq8-DTbIsh-kHOgt2s,1787
|
9
9
|
nucliadb_models/extracted.py,sha256=CBeC0hUphXq1T79K7Cpohuyg7f1pqTB4WGErb0HGgRs,6497
|
10
10
|
nucliadb_models/file.py,sha256=FKnaYUZPjxCEDUpbyDTudnHHKeSuQLfBnRR2FL6tL2s,1992
|
11
|
-
nucliadb_models/filters.py,sha256=
|
11
|
+
nucliadb_models/filters.py,sha256=xWSs5vHowbEHLfGGh8BTKBCZmFMY_rx6T0FR8Do2iPE,14503
|
12
12
|
nucliadb_models/labels.py,sha256=OUlX-apmFkibEN9bWThRJlbCD84hzJdddN1YYUV2Y3w,4201
|
13
13
|
nucliadb_models/link.py,sha256=x6YainEQ9gx6X1KF8oelA-RTaqjOesoWJNYENihDfgo,2262
|
14
14
|
nucliadb_models/metadata.py,sha256=ppwU__5IWHvBNDUT5EGLZxgpSBTwuA-rEpY-8Ef-Lwo,8600
|
@@ -32,7 +32,7 @@ nucliadb_models/graph/responses.py,sha256=3aimAHrd3YW1BXHU_ZXRoidlccRtkCcREkfCNo
|
|
32
32
|
nucliadb_models/internal/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
33
33
|
nucliadb_models/internal/predict.py,sha256=5rgUPrH_98gerySOZ-TR2PX_qzCGF1_8VxyOu3bGhis,2281
|
34
34
|
nucliadb_models/internal/shards.py,sha256=bcnkxF_zViHZfT6WTAMBcWgY3UV-OAV65cVdSqGkcHY,1943
|
35
|
-
nucliadb_models-6.4.0.
|
36
|
-
nucliadb_models-6.4.0.
|
37
|
-
nucliadb_models-6.4.0.
|
38
|
-
nucliadb_models-6.4.0.
|
35
|
+
nucliadb_models-6.4.0.post4241.dist-info/METADATA,sha256=72uIhNFBCdc1xaVdLPlYzcI-u0ols5EzCl__2to7MFQ,759
|
36
|
+
nucliadb_models-6.4.0.post4241.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
37
|
+
nucliadb_models-6.4.0.post4241.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
|
38
|
+
nucliadb_models-6.4.0.post4241.dist-info/RECORD,,
|
File without changes
|
{nucliadb_models-6.4.0.post4224.dist-info → nucliadb_models-6.4.0.post4241.dist-info}/top_level.txt
RENAMED
File without changes
|