Skip to content

Commit b55f3e7

Browse files
add descriptions for all Fields that didn't already have them
1 parent 1fec677 commit b55f3e7

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

src/anyvlm/schemas/vlm.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Schemas relating to VLM API."""
22

3-
from typing import Self
3+
from typing import Literal, Self
44

55
from pydantic import BaseModel, Field, model_validator
66

@@ -35,7 +35,10 @@ class BeaconHandover(BaseModel):
3535
class ReturnedSchema(BaseModel):
3636
"""Fixed [Beacon Schema](https://github.com/ga4gh-beacon/beacon-v2/blob/c6558bf2e6494df3905f7b2df66e903dfe509500/framework/json/common/beaconCommonComponents.json#L241)"""
3737

38-
entityType: str = RESULT_ENTITY_TYPE
38+
entityType: str = Field(
39+
default=RESULT_ENTITY_TYPE,
40+
description=f"The type of entity this response describes. Must always be set to '{RESULT_ENTITY_TYPE}'",
41+
)
3942
schema_: str = Field(
4043
default="ga4gh-beacon-variant-v2.0.0",
4144
# Alias is required because 'schema' is reserved by Pydantic's BaseModel class,
@@ -67,14 +70,21 @@ class Meta(BaseModel):
6770
class ResponseSummary(BaseModel):
6871
"""A high-level summary of the results provided in the parent `VlmResponse"""
6972

70-
exists: bool
71-
total: int
73+
exists: bool = Field(
74+
..., description="Indicates whether the response contains any results."
75+
)
76+
numTotalResults: int = Field(
77+
..., description="The total number of results found for the given query"
78+
)
7279

7380

7481
class ResultSet(BaseModel):
7582
"""A set of cohort allele frequency results. The zygosity of the ResultSet is identified in the `id` field"""
7683

77-
exists: bool
84+
exists: Literal[True] = Field(
85+
default=True,
86+
description="Indicates whether this ResultSet exists. This must always be `True`, even if `resultsCount` = `0`",
87+
)
7888
id: str = Field(
7989
...,
8090
description="id should be constructed of the `HandoverType.id` + the ResultSet's zygosity. See `validate_resultset_ids` validator in `VlmResponse` class.",
@@ -89,13 +99,18 @@ class ResultSet(BaseModel):
8999
resultsCount: int = Field(
90100
..., description="A count for the zygosity indicated by the ResultSet's `id`"
91101
)
92-
setType: str = RESULT_ENTITY_TYPE
102+
setType: str = Field(
103+
default=RESULT_ENTITY_TYPE,
104+
description=f"The type of entity relevant to these results. Must always be set to '{RESULT_ENTITY_TYPE}'",
105+
)
93106

94107

95108
class ResponseField(BaseModel):
96109
"""A list of ResultSets"""
97110

98-
resultSets: list[ResultSet]
111+
resultSets: list[ResultSet] = Field(
112+
..., description="A list of ResultSets for the given query."
113+
)
99114

100115

101116
class VlmResponse(BaseModel):

0 commit comments

Comments
 (0)