Show classes in server endpoint #191
3 changed files with 37 additions and 36 deletions
|
|
@ -1,3 +1,12 @@
|
|||
# 5.x.x (2026-01-28)
|
||||
|
||||
## New features
|
||||
|
||||
- The `/server`-endpoint result now contains the name of classes that are
|
||||
supported by the collections, i.e., classes for which storage- and
|
||||
validation-endpoints exist.
|
||||
|
||||
|
||||
# 5.3.6 (2026-01-13)
|
||||
|
||||
## Changes
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ class TokenCapabilityRequest(BaseModel):
|
|||
class ServerCollectionResponse(BaseModel):
|
||||
name: str
|
||||
schema: str
|
||||
classes: list[str]
|
||||
|
||||
|
||||
class ServerCollectionCountedResponse(ServerCollectionResponse):
|
||||
|
|
@ -416,6 +417,7 @@ async def server() -> ServerResponse:
|
|||
ServerCollectionResponse(
|
||||
name=collection_name,
|
||||
schema=g_instance_config.schemas[collection_name],
|
||||
classes=g_instance_config.model_info[collection_name][1],
|
||||
)
|
||||
for collection_name in g_instance_config.collections
|
||||
]
|
||||
|
|
|
|||
|
|
@ -392,50 +392,40 @@ def test_server(fastapi_client_simple):
|
|||
response = test_client.get(
|
||||
'/server',
|
||||
)
|
||||
test_schema_classes = [
|
||||
'Thing',
|
||||
'Agent',
|
||||
'InstantaneousEvent',
|
||||
'Person',
|
||||
]
|
||||
flat_social_classes = [
|
||||
'Thing',
|
||||
'Property',
|
||||
'ValueSpecification',
|
||||
'FlatThing',
|
||||
'FlatProperty',
|
||||
'AnnotationTag',
|
||||
'Organization',
|
||||
'Person',
|
||||
'Project',
|
||||
]
|
||||
assert response.status_code == HTTP_200_OK
|
||||
assert response.json() == {
|
||||
'version': __version__,
|
||||
'collections': [
|
||||
{
|
||||
'name': 'collection_1',
|
||||
'name': f'collection_{i}',
|
||||
'schema': str(schema_file),
|
||||
},
|
||||
'classes': test_schema_classes,
|
||||
}
|
||||
for i in range(1, 9)
|
||||
] + [
|
||||
{
|
||||
'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',
|
||||
'name': f'collection_dlflatsocial-{i}',
|
||||
'schema': 'https://concepts.datalad.org/s/flat-social/unreleased.yaml',
|
||||
},
|
||||
{
|
||||
'name': 'collection_dlflatsocial-2',
|
||||
'schema': 'https://concepts.datalad.org/s/flat-social/unreleased.yaml',
|
||||
},
|
||||
'classes': flat_social_classes,
|
||||
}
|
||||
for i in range(1, 3)
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue