From 7e6cffb00c1c0dc172cefb42f116418d8355b72c Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Sat, 5 Jul 2025 08:29:54 -0700 Subject: [PATCH] fix: resolve FastAPI deprecation warning for example fields Signed-off-by: Emmanuel Ferdman --- invokeai/app/api/routers/images.py | 2 +- invokeai/app/api/routers/model_manager.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/app/api/routers/images.py b/invokeai/app/api/routers/images.py index dfc4d63d19..e9cfa3c28c 100644 --- a/invokeai/app/api/routers/images.py +++ b/invokeai/app/api/routers/images.py @@ -72,7 +72,7 @@ async def upload_image( resize_to: Optional[str] = Body( default=None, description=f"Dimensions to resize the image to, must be stringified tuple of 2 integers. Max total pixel count: {ResizeToDimensions.MAX_SIZE}", - example='"[1024,1024]"', + examples=['"[1024,1024]"'], ), metadata: Optional[str] = Body( default=None, diff --git a/invokeai/app/api/routers/model_manager.py b/invokeai/app/api/routers/model_manager.py index df938f89b1..e62a5a5b60 100644 --- a/invokeai/app/api/routers/model_manager.py +++ b/invokeai/app/api/routers/model_manager.py @@ -292,7 +292,7 @@ async def get_hugging_face_models( ) async def update_model_record( key: Annotated[str, Path(description="Unique key of model")], - changes: Annotated[ModelRecordChanges, Body(description="Model config", example=example_model_input)], + changes: Annotated[ModelRecordChanges, Body(description="Model config", examples=[example_model_input])], ) -> AnyModelConfig: """Update a model's config.""" logger = ApiDependencies.invoker.services.logger @@ -450,7 +450,7 @@ async def install_model( access_token: Optional[str] = Query(description="access token for the remote resource", default=None), config: ModelRecordChanges = Body( description="Object containing fields that override auto-probed values in the model config record, such as name, description and prediction_type ", - example={"name": "string", "description": "string"}, + examples=[{"name": "string", "description": "string"}], ), ) -> ModelInstallJob: """Install a model using a string identifier.