diff --git a/examples/full_static_fastapi_example.py b/examples/full_static_fastapi_example.py index 4d3b8b4..5210238 100644 --- a/examples/full_static_fastapi_example.py +++ b/examples/full_static_fastapi_example.py @@ -2,9 +2,9 @@ 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 query = """ @@ -48,5 +48,5 @@ class Author(BaseModel): @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) diff --git a/examples/releven_person_fastapi_example.py b/examples/releven_person_fastapi_example.py index 15c31f0..1b98280 100644 --- a/examples/releven_person_fastapi_example.py +++ b/examples/releven_person_fastapi_example.py @@ -1,8 +1,10 @@ """RDFProxy-based FastAPI route example: CRM query targeting Releven GraphDB with simple ungrouped Person model.""" -from fastapi import FastAPI +from typing import Annotated + +from fastapi import FastAPI, Query from pydantic import BaseModel -from rdfproxy import Page, SPARQLModelAdapter +from rdfproxy import Page, QueryParameters, SPARQLModelAdapter query = """ @@ -66,5 +68,7 @@ class R11PersonModel(BaseModel): @app.get("/") -def base(page: int = 1, size: int = 100) -> Page[R11PersonModel]: - return adapter.query(page=page, size=size) +def base_route( + query_parameters: Annotated[QueryParameters, Query()], +) -> Page[R11PersonModel]: + return adapter.query(query_parameters) diff --git a/examples/wikidata_grouped_person_fastapi_example.py b/examples/wikidata_grouped_person_fastapi_example.py index c6a8868..0e06def 100644 --- a/examples/wikidata_grouped_person_fastapi_example.py +++ b/examples/wikidata_grouped_person_fastapi_example.py @@ -2,9 +2,9 @@ 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 query = """ @@ -40,5 +40,5 @@ class Person(BaseModel): @app.get("/") -def base(page: int = 1, size: int = 100) -> Page[Person]: - return adapter.query(page=page, size=size) +def base_route(query_parameters: Annotated[QueryParameters, Query()]) -> Page[Person]: + return adapter.query(query_parameters) diff --git a/examples/wikidata_ungrouped_person_fastapi_example.py b/examples/wikidata_ungrouped_person_fastapi_example.py index 8387f9d..9421210 100644 --- a/examples/wikidata_ungrouped_person_fastapi_example.py +++ b/examples/wikidata_ungrouped_person_fastapi_example.py @@ -2,9 +2,9 @@ from typing import Annotated -from fastapi import FastAPI +from fastapi import FastAPI, Query from pydantic import BaseModel -from rdfproxy import Page, SPARQLBinding, SPARQLModelAdapter +from rdfproxy import Page, QueryParameters, SPARQLBinding, SPARQLModelAdapter query = """ @@ -38,5 +38,5 @@ class Person(BaseModel): @app.get("/") -def base(page: int = 1, size: int = 100) -> Page[Person]: - return adapter.query(page=page, size=size) +def base_route(query_parameters: Annotated[QueryParameters, Query()]) -> Page[Person]: + return adapter.query(query_parameters)