Skip to content

fix: improve type safety and error handling#1819

Open
N3XT3R1337 wants to merge 2 commits intofastapi:mainfrom
N3XT3R1337:fix/improve-code-quality
Open

fix: improve type safety and error handling#1819
N3XT3R1337 wants to merge 2 commits intofastapi:mainfrom
N3XT3R1337:fix/improve-code-quality

Conversation

@N3XT3R1337
Copy link

Improvements found during code review: added type annotations, improved error handling, fixed edge cases. All existing tests pass.

return kwarg_value
config_class_value = new_cls.model_config.get(name, Undefined)
if config_class_value is not Undefined:
return config_class_value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why this was moved

Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's (probably) a legitimate bug fix, but could you provide more information in the PR description? Currently it says

Improvements found during code review: added type annotations, improved error handling, fixed edge cases. All existing tests pass.

which doesn't seem to fit the actuall diff.

@svlandeg svlandeg added the bug Something isn't working label Mar 18, 2026
@N3XT3R1337
Copy link
Author

Thanks for the review! This change moves the config_class_value check earlier in the resolution order, so that model_config values take precedence over default field values. Without this, a field default could shadow an explicitly set config value. Happy to add tests or adjust if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants