acdh-oeaw / rdfproxy

GNU General Public License v3.0
2 stars 0 forks source link

SPARQLModelAdapter.query_group_by should return some model instance, not dict #42

Closed lu-pl closed 3 months ago

lu-pl commented 3 months ago

SPARQLModelAdapter.query_group_by should return some model instance instead of dict, else grouping results cannot be properly served over FastAPI.

It should return a list of GroupModel where GroupModel is something like this:

class GroupModel(BaseModel):
    group_by: str
    group_key: str
    group_value: list[BaseModel]

The existing defaultdict implementation can be used to initialize GroupModels from the group dict, so this shouldn't be too much work.

lu-pl commented 3 months ago

FastAPI derives the correct JSON schema and Swagger definitions from dicts, so this is obsolete. Closing.