From d2677919953429b8b77de54919539c8685c6886e Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 2 Dec 2025 15:13:31 +0100 Subject: [PATCH 1/4] add collection info to `/server`-result --- dump_things_service/main.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dump_things_service/main.py b/dump_things_service/main.py index 3c72f54..8fafc02 100644 --- a/dump_things_service/main.py +++ b/dump_things_service/main.py @@ -97,8 +97,18 @@ class TokenCapabilityRequest(BaseModel): token: str | None +class ServerCollectionResponse(BaseModel): + name: str + schema: str + + +class ServerCollectionCountedResponse(ServerCollectionResponse): + records: int + + class ServerResponse(BaseModel): version: str + collections: list[ServerCollectionResponse|ServerCollectionCountedResponse] logging.basicConfig(level=logging.WARNING) @@ -393,9 +403,16 @@ def validate_record( tags=['Server info'], name='get server information' ) -async def get_server() -> ServerResponse: +async def server() -> ServerResponse: return ServerResponse( version = __version__, + collections = [ + ServerCollectionResponse( + name=collection_name, + schema=g_instance_config.schemas[collection_name], + ) + for collection_name in g_instance_config.collections + ] ) -- 2.52.0 From 3a6b60608472498d57f4c64b65af97493a8ec2c3 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 2 Dec 2025 15:17:48 +0100 Subject: [PATCH 2/4] bump version, upodate CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ dump_things_service/__about__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 545f9f7..6e76be1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 5.3.0 (2025-12-02) + +## New features + +- The `/server`-endpoint result now contains the name of collections and the + schemas that are used by the collections. + + # 5.2.1 (2025-11-26) ## Changes diff --git a/dump_things_service/__about__.py b/dump_things_service/__about__.py index 4dc2ef2..1d4672f 100644 --- a/dump_things_service/__about__.py +++ b/dump_things_service/__about__.py @@ -1 +1 @@ -__version__ = '5.2.1' +__version__ = '5.3.0' -- 2.52.0 From aace6d71ad61fb6d118ed4e9b786043971607f76 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 2 Dec 2025 15:33:41 +0100 Subject: [PATCH 3/4] fix server test --- dump_things_service/tests/test_basic.py | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dump_things_service/tests/test_basic.py b/dump_things_service/tests/test_basic.py index 8a52b00..4edb46c 100644 --- a/dump_things_service/tests/test_basic.py +++ b/dump_things_service/tests/test_basic.py @@ -1,3 +1,5 @@ +from pathlib import Path + import pytest # F401 from .. import ( @@ -14,6 +16,9 @@ from .create_store import ( ) from .test_utils import basic_write_locations +# Path to a local simple test schema +schema_file = Path(__file__).parent / 'testschema.yaml' + extra_record = { 'schema_type': 'abc:Person', 'pid': 'abc:aaaa', @@ -390,6 +395,48 @@ def test_server(fastapi_client_simple): assert response.status_code == HTTP_200_OK assert response.json() == { 'version': __version__, + 'collections': [ + { + 'name': 'collection_1', + 'schema': str(schema_file), + }, + { + 'name': 'collection_2', + 'schema': str(schema_file), + }, + { + 'name': 'collection_3', + 'schema': str(schema_file), + }, + { + 'name': 'collection_4', + 'schema': str(schema_file), + }, + { + 'name': 'collection_5', + 'schema': str(schema_file), + }, + { + 'name': 'collection_6', + 'schema': str(schema_file), + }, + { + 'name': 'collection_7', + 'schema': str(schema_file), + }, + { + 'name': 'collection_8', + 'schema': str(schema_file), + }, + { + 'name': 'collection_dlflatsocial-1', + 'schema': 'https://concepts.datalad.org/s/flat-social/unreleased.yaml', + }, + { + 'name': 'collection_dlflatsocial-2', + 'schema': 'https://concepts.datalad.org/s/flat-social/unreleased.yaml', + }, + ], } -- 2.52.0 From 26500a02718088af6de566c1ef1f586d1b808751 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 2 Dec 2025 21:49:23 +0100 Subject: [PATCH 4/4] update README.md --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 078229a..f1b18fa 100644 --- a/README.md +++ b/README.md @@ -701,7 +701,17 @@ The service provides the following user endpoints (in addition to user-endpoints The response is a JSON object with the following structure: ```json { - "version": "" + "version": "", + "collections": [ + { + "name": "collection_1", + "schema": "https://example.org/schema_1.yaml" + }, + { + "name": "collection_2", + "schema": "https://example.org/schema_2.yaml" + }, + ] } ``` -- 2.52.0