Skip to content

Commit 1c97bc5

Browse files
fix encoders_by_class generation
1 parent bf55934 commit 1c97bc5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/models-library/src/models_library/utils/_original_fastapi_encoders.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from enum import Enum
99
from pathlib import PurePath
1010
from types import GeneratorType
11-
from typing import Any, Callable, Union
11+
from typing import Any, Callable, Union, get_origin
1212

1313
from common_library.json_serialization import ENCODERS_BY_TYPE
1414
from pydantic import BaseModel
@@ -28,7 +28,8 @@ def generate_encoders_by_class_tuples(
2828
tuple
2929
)
3030
for type_, encoder in type_encoder_map.items():
31-
encoders_by_class_tuples[encoder] += (type_,)
31+
if get_origin(type_) is not Annotated:
32+
encoders_by_class_tuples[encoder] += (type_,)
3233
return encoders_by_class_tuples
3334

3435

0 commit comments

Comments
 (0)