From 49a892c20d7d2a43e8fdf43443c3fd3ccc0a9371 Mon Sep 17 00:00:00 2001 From: Lukas Plank Date: Thu, 28 Nov 2024 06:06:49 +0100 Subject: [PATCH] docs(readme): adapt readme for query parameter model --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 593232f..d8940c0 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,9 @@ The result set can be mapped to a nested Pydantic model like so: ```python from typing import Annotated -from fastapi import FastAPI +from fastapi import FastAPI, Query from pydantic import BaseModel, ConfigDict -from rdfproxy import Page, SPARQLBinding, SPARQLModelAdapter +from rdfproxy import Page, QueryParameters, SPARQLBinding, SPARQLModelAdapter class Work(BaseModel): model_config = ConfigDict(group_by="workName") @@ -77,8 +77,8 @@ The `SPARQLModelAdapter.query` method runs the query and constructs a `Page` obj app = FastAPI() @app.get("/") -def base_route(page: int = 1, size: int = 100) -> Page[Author]: - return adapter.query(page=page, size=size) +def base_route(query_parameters: Annotated[QueryParameters, Query()]) -> Page[Author]: + return adapter.query(query_parameters) ``` This results in the following JSON output: