nucliadb-models 6.3.5.post4017__py3-none-any.whl → 6.3.5.post4023__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.
@@ -29,19 +29,27 @@ from .common import FieldTypeName, Paragraph
29
29
  from .metadata import ResourceProcessingStatus
30
30
  from .utils import DateTime
31
31
 
32
- F = TypeVar("F")
32
+ F = TypeVar("F", bound=BaseModel)
33
33
 
34
34
 
35
35
  class And(BaseModel, Generic[F], extra="forbid"):
36
36
  """AND of other expressions"""
37
37
 
38
- operands: list[F] = pydantic.Field(alias="and")
38
+ operands: list[F] = pydantic.Field(alias="and", min_length=1)
39
+
40
+ @pydantic.model_serializer
41
+ def serialize_boolean(self) -> dict[str, Any]:
42
+ return {"and": [op.model_dump() for op in self.operands]}
39
43
 
40
44
 
41
45
  class Or(BaseModel, Generic[F], extra="forbid"):
42
46
  """OR of other expressions"""
43
47
 
44
- operands: list[F] = pydantic.Field(alias="or")
48
+ operands: list[F] = pydantic.Field(alias="or", min_length=1)
49
+
50
+ @pydantic.model_serializer
51
+ def serialize_boolean(self) -> dict[str, Any]:
52
+ return {"or": [op.model_dump() for op in self.operands]}
45
53
 
46
54
 
47
55
  class Not(BaseModel, Generic[F], extra="forbid"):
@@ -49,6 +57,10 @@ class Not(BaseModel, Generic[F], extra="forbid"):
49
57
 
50
58
  operand: F = pydantic.Field(alias="not")
51
59
 
60
+ @pydantic.model_serializer
61
+ def serialize_boolean(self) -> dict[str, Any]:
62
+ return {"not": self.operand.model_dump()}
63
+
52
64
 
53
65
  class Resource(BaseModel, extra="forbid"):
54
66
  """Matches all fields of a resource given its id or slug"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_models
3
- Version: 6.3.5.post4017
3
+ Version: 6.3.5.post4023
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License: AGPL
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -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=iUwxQcX8LuFbQekuPatM_YSwlTd0UxsowjC636zVMjQ,13199
11
+ nucliadb_models/filters.py,sha256=WwQbbH-HM_-sPji0xbZjOxgPJ0iEWzVAh7Y3rxrFxbk,13674
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=uZLsMkYWrJDHq3xy_w7snSeV2X3aDBuht9GC_MG3sKc,1976
35
- nucliadb_models-6.3.5.post4017.dist-info/METADATA,sha256=xNDvQlf44AJIC5XRGchq8X2xGZ_T7QZnSp1JYSjypvg,759
36
- nucliadb_models-6.3.5.post4017.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
37
- nucliadb_models-6.3.5.post4017.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
- nucliadb_models-6.3.5.post4017.dist-info/RECORD,,
35
+ nucliadb_models-6.3.5.post4023.dist-info/METADATA,sha256=D4CjM1WqQuqLaOvlYh4oEP6KqNZUZ1A-Vm4DvUOqFT0,759
36
+ nucliadb_models-6.3.5.post4023.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
37
+ nucliadb_models-6.3.5.post4023.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
+ nucliadb_models-6.3.5.post4023.dist-info/RECORD,,