diff options
| author | Max Nanis | 2026-02-19 02:43:23 -0500 |
|---|---|---|
| committer | Max Nanis | 2026-02-19 02:43:23 -0500 |
| commit | f0f96f83c2630e890a2cbcab53f77fd4c37e1684 (patch) | |
| tree | c6d2cb092e76bf5d499e0ea9949508d6b22164fd /jb/models/api_response.py | |
| parent | 3eaa56f0306ead818f64c3d99fc6d230d9b970a4 (diff) | |
| download | amt-jb-f0f96f83c2630e890a2cbcab53f77fd4c37e1684.tar.gz amt-jb-f0f96f83c2630e890a2cbcab53f77fd4c37e1684.zip | |
Diffstat (limited to 'jb/models/api_response.py')
| -rw-r--r-- | jb/models/api_response.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/jb/models/api_response.py b/jb/models/api_response.py new file mode 100644 index 0000000..6b29e51 --- /dev/null +++ b/jb/models/api_response.py @@ -0,0 +1,17 @@ +from pydantic import BaseModel, ConfigDict, Field, model_validator + +from jb.models.assignment import Assignment +from jb.models.hit import Hit + + +class AssignmentResponse(BaseModel): + model_config = ConfigDict(extra="forbid", validate_assignment=True) + + assignment: Assignment = Field(alias="Assignment") + hit: Hit = Field(alias="HIT") + + @model_validator(mode="after") + def check_consistent_hit_id(self) -> "AssignmentResponse": + if self.hit.id != self.assignment.hit_id: + raise ValueError("Inconsistent Hit IDs") + return self |
