SetIntStr and DictIntStrAny disappeared from encoders #10171
-
First Check
Commit to Help
Example Codefrom fastapi.encoders import SetIntStr, DictIntStrAny
def route(
response_model_include: Optional[Union[SetIntStr, DictIntStrAny]] = None,
response_model_exclude: Optional[Union[SetIntStr, DictIntStrAny]] = None
):
... some code ...Descriptioncannot import name 'SetIntStr' from 'fastapi.encoders' Operating SystemLinux Operating System DetailsUbuntu 22.04 FastAPI Version0.100.0 Pydantic Version1.10.12 Python Version3.10 Additional ContextThe FastAPI version 0.99.0 did contain the following definition in the "encoders" module: SetIntStr = Set[Union[int, str]] def generate_encoders_by_class_tuples( But from the version 0.100.0 and following, both SetIntStr and DictIntStrAny disappeared. I've looked inside the FastAPI's changelogs but didn't find any reference about this. There are some projects out there (like FastAPI-Gateway and similar projects) that makes use of them... Are there any chanches that you reimplement these in the future versions? Thank you in advance |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
I had the same issue. |
Beta Was this translation helpful? Give feedback.
-
|
Facing the same issue with FastAPI SetIntStr = Set[Union[int, str]]
DictIntStrAny = Dict[Union[int, str], Any] |
Beta Was this translation helpful? Give feedback.
-
|
Use from fastapi.types import IncEx
def route(
response_model_include: Optional[IncEx] = None,
response_model_exclude: Optional[IncEx] = None
): |
Beta Was this translation helpful? Give feedback.
Use
from fastapi.types import IncEx: