Skip to content

Commit

Permalink
Add a pragma and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut committed Sep 15, 2024
1 parent 1185932 commit 5ee9ba2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions litestar/_openapi/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self) -> None:
self._schema_key_map: dict[tuple[str, ...], RegisteredSchema] = {}
self._schema_reference_map: dict[int, RegisteredSchema] = {}
self._model_name_groups: defaultdict[str, list[RegisteredSchema]] = defaultdict(list)
self._component_type_map: dict[str, FieldDefinition] = {}
self._component_type_map: dict[tuple[str, ...], FieldDefinition] = {}

def get_schema_for_field_definition(self, field: FieldDefinition) -> Schema:
"""Get a registered schema by its key.
Expand Down Expand Up @@ -146,7 +146,10 @@ def get_reference_for_field_definition(self, field: FieldDefinition) -> Referenc
f"Schema component keys must be unique. While obtaining a reference for the type '{field.raw!r}', the "
f"generated key {'_'.join(key)!r} was already associated with a different type '{existing_type.raw!r}'. "
)
if key_override := _get_component_key_override(field):
if key_override := _get_component_key_override(field): # pragma: no cover
# Currently, this can never not be true, however, in the future we might
# decide to do a stricter equality check as lined out above, in which
# case there can be other cases than overrides that cause this error
msg += f"Hint: Both types are defining a 'schema_component_key' with the value of {key_override!r}"
raise ImproperlyConfiguredException(msg)

Expand Down

0 comments on commit 5ee9ba2

Please sign in to comment.