diff --git a/routers/groups.py b/routers/groups.py index 8edb5c0..f524650 100644 --- a/routers/groups.py +++ b/routers/groups.py @@ -15,7 +15,7 @@ logger = logging.getLogger(__name__) router = APIRouter( - prefix=BASE_PATH+"/Groups", + prefix=BASE_PATH + "/Groups", tags=["SCIM Groups"], ) @@ -33,7 +33,7 @@ async def get_all_groups( @router.post("", status_code=status.HTTP_201_CREATED) async def create_group( group: Group = Body( - example={ + examples={ "displayName": "Student", "externalId": "273aca56-d86a-4f05-a159-51856b5cb1b3@sram.surf.nl", "members": [ diff --git a/routers/users.py b/routers/users.py index 16fdcd4..43d759d 100644 --- a/routers/users.py +++ b/routers/users.py @@ -14,7 +14,7 @@ logger = logging.getLogger(__name__) router = APIRouter( - prefix=BASE_PATH+"/Users", + prefix=BASE_PATH + "/Users", tags=["SCIM Users"], ) @@ -32,7 +32,7 @@ async def get_all_users( @router.post("", status_code=status.HTTP_201_CREATED) async def create_user( user: User = Body( - example={ + examples={ "externalId": "string", "active": True, "name": { diff --git a/server.py b/server.py index 3a52ee6..af1950a 100755 --- a/server.py +++ b/server.py @@ -6,6 +6,8 @@ from fastapi.exceptions import RequestValidationError from fastapi.responses import JSONResponse +from contextlib import asynccontextmanager + from routers import BASE_PATH, config, resource, schema, users, groups from utils.auth import api_key_auth from utils import host, port @@ -18,7 +20,18 @@ logging.basicConfig(level=level) logger = logging.getLogger(__name__) + +@asynccontextmanager +async def lifespan(app: FastAPI): + # Why is this here in the first place? + pass + yield + pass + +app = FastAPI(lifespan=lifespan) + app = FastAPI( + lifespan=lifespan, title="SCIM Sample", docs_url=BASE_PATH if BASE_PATH.startswith('/') else '/', redoc_url=None, @@ -38,16 +51,6 @@ app.include_router(groups.router) -@app.on_event("startup") -def startup(): - pass - - -@app.on_event("shutdown") -def shutdown(): - pass - - @app.exception_handler(RequestValidationError) async def validation_exception_handler( request: Request,