chore: add type hints to schema registration functions#5264
Open
Elbehery wants to merge 3 commits intollamastack:mainfrom
Open
chore: add type hints to schema registration functions#5264Elbehery wants to merge 3 commits intollamastack:mainfrom
Elbehery wants to merge 3 commits intollamastack:mainfrom
Conversation
959bcd3 to
05be5f0
Compare
Contributor
Author
leseb
previously requested changes
Mar 24, 2026
Collaborator
leseb
left a comment
There was a problem hiding this comment.
please remove that entry from pyproject.toml
05be5f0 to
b2dc849
Compare
Contributor
Author
sry, I am trying to keep the changes minimal 👍🏽 |
cdoern
reviewed
Mar 24, 2026
Contributor
Author
the exclude list in pyproject.toml contains only files under ref |
b2dc849 to
4da0d10
Compare
e530b43 to
4e6d21c
Compare
This change adds complete type annotations to json_schema_type and register_schema functions in schema_utils.py to satisfy mypy's --disallow-untyped-defs requirement. Both functions are decorators used for registering Pydantic models and schema types in the OpenAPI generation system. Uses modern Python 3.12+ generic function syntax (def func[T]) for type parameters, matching the existing pattern used in ExtraBodyField[T]. This provides proper type preservation through the decorator chain while maintaining backward compatibility. Type ignore comments are used for dynamic attribute assignment where the decorator adds runtime attributes to classes. All changes pass mypy strict checking and maintain full backward compatibility. Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
4e6d21c to
a11705c
Compare
mattf
reviewed
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
This change adds complete type annotations to json_schema_type and
register_schema functions in schema_utils.py to satisfy mypy's
--disallow-untyped-defs requirement. Both functions are decorators used
for registering Pydantic models and schema types in the OpenAPI generation
system.
Uses modern Python 3.12+ generic function syntax (def func[T]) for type
parameters, matching the existing pattern used in ExtraBodyField[T]. This
provides proper type preservation through the decorator chain while
maintaining backward compatibility.
Type ignore comments are used for dynamic attribute assignment where the
decorator adds runtime attributes to classes. All changes pass mypy strict
checking and maintain full backward compatibility.
Test Plan