@@ -540,14 +540,7 @@ async def __call__(self, *args: Any, **kwargs: Any):
540540@final
541541class _AnnotationTransformer :
542542 def __init__ (self , generator : "SchemaGenerator" ) -> None :
543- # This cache is not here for speeding things up. It's for preventing the creation of copies of the same object
544- # because such copies could produce weird behaviors at runtime, especially if you/FastAPI do any comparisons.
545- # It's defined here and not on the method because of this: https://youtu.be/sVjtp6tGo0g
546543 self .generator = generator
547- # TODO: Rewrite this to memoize
548- self .change_versions_of_a_non_container_annotation = functools .cache (
549- self ._change_version_of_a_non_container_annotation
550- )
551544
552545 def change_version_of_annotation (self , annotation : Any ) -> Any :
553546 """Recursively go through all annotations and change them to annotations corresponding to the version passed.
@@ -565,7 +558,7 @@ def change_version_of_annotation(self, annotation: Any) -> Any:
565558 elif isinstance (annotation , (list , tuple )):
566559 return type (annotation )(self .change_version_of_annotation (v ) for v in annotation )
567560 else :
568- return self .change_versions_of_a_non_container_annotation (annotation )
561+ return self ._change_version_of_a_non_container_annotation (annotation )
569562
570563 def migrate_router_to_version (self , router : fastapi .routing .APIRouter ):
571564 for route in router .routes :
0 commit comments