about summary refs log tree commit diff
path: root/test/python/test_openapi.py
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-10-03 14:57:25 +0000
committerPjotr <wrk@bosa.lan>2026-10-04 06:23:13 +0000
commit18f20d6df2310ef822e541791770dfe9d7b26fc2 (patch)
treeac0f12720d8c2800325129f5f55d4154d0fbba52 /test/python/test_openapi.py
parent924bcf3d25c01ccfd1cdf04bcc0308c5c1fd4ddb (diff)
downloadgenenetwork4-18f20d6df2310ef822e541791770dfe9d7b26fc2.tar.gz
Add GET /groups/{group}/traits/{trait_id}/values, publish trait data.
* src/db.rs (TraitValue): New struct.
(get_group_trait_values): New function. Joins PublishData, Strain and
PublishXRef by group Id and PublishXRef.Id, matching gn-guile's
gn.data.dataset:get-bxd-publish-name-value-dict generalized beyond
BXD: PublishXRef.Id alone isn't unique across groups, only the pair
(InbredSetId, Id) is, the same way GeneNetwork2's
wqflask.api.router.trait_sample_data combines trait_name with a group
or dataset to resolve a Publish trait.
* src/lib.rs (GroupTraitLookup): New enum, distinguishes a missing
group from a missing trait in an existing group.
(get_group_trait_values_result): New function, looks up a group then
its trait, returning a GroupTraitLookup.
(group_trait_values): New handler for GET
/groups/{group}/traits/{trait_id}/values. 404s as group_not_found or
trait_not_found depending on what get_group_trait_values_result
found.
(app): Register it.
* tests/group_trait_values.rs, test/python/test_group_trait_values.py:
New files.
* tests/openapi.rs, test/python/test_openapi.py: Check the new path
is in the generated spec.
* README.md (GET /groups/{group}/traits/{trait_id}/values): Document
it, including that only Publish (phenotype) traits are supported so
far, not ProbeSet or Geno traits.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
Diffstat (limited to 'test/python/test_openapi.py')
-rw-r--r--test/python/test_openapi.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/python/test_openapi.py b/test/python/test_openapi.py
index 3b43f18..753df4e 100644
--- a/test/python/test_openapi.py
+++ b/test/python/test_openapi.py
@@ -28,6 +28,7 @@ class OpenApiTest(ServerTestCase):
             "/groups",
             "/groups/{group}",
             "/groups/{group}/strains",
+            "/groups/{group}/traits/{trait_id}/values",
         ):
             self.assertIn(path, doc["paths"])