Skip to content

fix: resolve FastAPI deprecation warning for example fields #8203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invokeai/app/api/routers/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions invokeai/app/api/routers/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 0 additions & 14 deletions invokeai/frontend/web/src/services/api/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22266,16 +22266,6 @@ export interface operations {
};
requestBody: {
content: {
/** @example {
* "path": "/path/to/model",
* "name": "model_name",
* "base": "sd-1",
* "type": "main",
* "format": "checkpoint",
* "config_path": "configs/stable-diffusion/v1-inference.yaml",
* "description": "Model description",
* "variant": "normal"
* } */
"application/json": components["schemas"]["ModelRecordChanges"];
};
};
Expand Down Expand Up @@ -22579,10 +22569,6 @@ export interface operations {
};
requestBody: {
content: {
/** @example {
* "name": "string",
* "description": "string"
* } */
"application/json": components["schemas"]["ModelRecordChanges"];
};
};
Expand Down