From 27977b45b5b234c06778dec527f2fa101f6a6290 Mon Sep 17 00:00:00 2001 From: Christian Oertlin Date: Wed, 3 Apr 2024 15:20:18 +0200 Subject: [PATCH] fix --- genotype_api/api/endpoints/samples.py | 10 ++++++++ genotype_api/models.py | 34 +++++++++++++-------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/genotype_api/api/endpoints/samples.py b/genotype_api/api/endpoints/samples.py index 35425dc..73dcb20 100644 --- a/genotype_api/api/endpoints/samples.py +++ b/genotype_api/api/endpoints/samples.py @@ -70,6 +70,16 @@ def create_sample( @router.get( "/", response_model=list[SampleResponse], + response_model_exclude={ + "detail": { + "sex": True, + "nocalls": True, + "snps": True, + "matches": True, + "mismatches": True, + "unknown": True, + }, + }, ) def read_samples( skip: int = 0, diff --git a/genotype_api/models.py b/genotype_api/models.py index 5d13d6b..75a52ff 100644 --- a/genotype_api/models.py +++ b/genotype_api/models.py @@ -2,28 +2,28 @@ class SampleDetailStats(BaseModel): - matches: int | None - mismatches: int | None - unknown: int | None + matches: int | None = None + mismatches: int | None = None + unknown: int | None = None class SampleDetailStatus(BaseModel): - sex: str | None - snps: str | None - nocalls: str | None + sex: str | None = None + snps: str | None = None + nocalls: str | None = None class SampleDetail(BaseModel): - sex: str | None - snps: str | None - nocalls: str | None - matches: int | None - mismatches: int | None - unknown: int | None - failed_snps: list[str] | None + sex: str | None = None + snps: str | None = None + nocalls: str | None = None + matches: int | None = None + mismatches: int | None = None + unknown: int | None = None + failed_snps: list[str] | None = None - stats: SampleDetailStats | None - status: SampleDetailStatus | None + stats: SampleDetailStats | None = None + status: SampleDetailStatus | None = None @validator("stats") def validate_stats(cls, value, values) -> SampleDetailStats: @@ -50,5 +50,5 @@ class MatchCounts(BaseModel): class MatchResult(BaseModel): - sample_id: str - match_results: MatchCounts + sample_id: str = None + match_results: MatchCounts | None = None