Pydentic scheme for CacheConfiguration and RouteInfo#7
Conversation
There was a problem hiding this comment.
Bug: Cache Configuration Validator Returns Inconsistent Types
The CacheConfiguration.invalidate_paths field validator (compile_paths) has inconsistent return types, violating its list[re.Pattern] | None annotation. It returns a single re.Pattern object for string or single pattern inputs, and can produce nested lists (e.g., list[list[re.Pattern]]) for nested list inputs. This type mismatch causes runtime errors when consuming code expects to iterate over a flat list of patterns.
fast_cache_middleware/schemas.py#L45-L59
FastCacheMiddleware/fast_cache_middleware/schemas.py
Lines 45 to 59 in 3b874de
Bug: Zero TTL Incorrectly Disables Caching
The condition if not cache_configuration.max_age: incorrectly disables caching when max_age is 0. This changes the previous behavior where max_age=0 was a valid TTL for immediate expiration. Caching should only be disabled when max_age is None.
fast_cache_middleware/middleware.py#L257-L259
FastCacheMiddleware/fast_cache_middleware/middleware.py
Lines 257 to 259 in 3b874de
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.