mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore/fix: bump fastapi to 0.105.0
This fixes a problem with `Annotated` which prevented us from using pydantic's `Field` to specify a discriminator for a union. We had to use FastAPI's `Body` as a workaround.
This commit is contained in:
parent
15de7c21d9
commit
d7cede6c28
@ -5,7 +5,6 @@ from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
|
||||
from fastapi import Body
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from pydantic.networks import AnyHttpUrl
|
||||
from typing_extensions import Annotated
|
||||
@ -112,17 +111,7 @@ class URLModelSource(StringLikeSource):
|
||||
return str(self.url)
|
||||
|
||||
|
||||
# Body() is being applied here rather than Field() because otherwise FastAPI will
|
||||
# refuse to generate a schema. Relevant links:
|
||||
#
|
||||
# "Model Manager Refactor Phase 1 - SQL-based config storage
|
||||
# https://github.com/invoke-ai/InvokeAI/pull/5039#discussion_r1389752119 (comment)
|
||||
# Param: xyz can only be a request body, using Body() when using discriminated unions
|
||||
# https://github.com/tiangolo/fastapi/discussions/9761
|
||||
# Body parameter cannot be a pydantic union anymore sinve v0.95
|
||||
# https://github.com/tiangolo/fastapi/discussions/9287
|
||||
|
||||
ModelSource = Annotated[Union[LocalModelSource, HFModelSource, URLModelSource], Body(discriminator="type")]
|
||||
ModelSource = Annotated[Union[LocalModelSource, HFModelSource, URLModelSource], Field(discriminator="type")]
|
||||
|
||||
|
||||
class ModelInstallJob(BaseModel):
|
||||
|
@ -47,7 +47,7 @@ dependencies = [
|
||||
"easing-functions",
|
||||
"einops",
|
||||
"facexlib",
|
||||
"fastapi~=0.104.1",
|
||||
"fastapi~=0.105.0",
|
||||
"fastapi-events~=0.9.1",
|
||||
"huggingface-hub~=0.16.4",
|
||||
"imohash",
|
||||
|
Loading…
Reference in New Issue
Block a user