Browse Source
`get_definitions()` uses a set comprehension to collect field annotations
for deduplication. However, on Python 3.14 with Pydantic v2.13+, some
`Annotated` types contain `FieldInfoMetadata` objects that are not
hashable, causing a `TypeError`:
TypeError: cannot use 'typing._AnnotatedAlias' as a set element
(unhashable type: 'FieldInfoMetadata')
This is triggered when routes use `Annotated` parameters with metadata
such as `Query(max_length=..., description=...)` or similar constructs
that produce unhashable Pydantic field metadata.
Fix: use `id()` for identity-based deduplication instead of relying on
`__hash__` of annotation objects. Since annotations are interned type
objects, `id()` comparison is semantically equivalent for this filtering
purpose.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
pull/15429/head
1 changed files with 2 additions and 2 deletions
Loading…
Reference in new issue