Skip to content

Add fuzzy typo detection to RompyBaseModel#27

Merged
tomdurrant merged 1 commit intomainfrom
fuzzy_hints
Mar 16, 2026
Merged

Add fuzzy typo detection to RompyBaseModel#27
tomdurrant merged 1 commit intomainfrom
fuzzy_hints

Conversation

@tomdurrant
Copy link
Contributor

Summary

  • Adds a model_validator to RompyBaseModel that detects typos in field names
  • Uses difflib.get_close_matches with 0.6 cutoff to suggest close field name matches
  • Example: User(usernme="bob") now raises ValueError: Unknown field 'usernme'. Did you mean 'username'?

Raises helpful error messages when unknown field names are provided,
suggesting close matches using difflib.get_close_matches with 0.6 cutoff.
@tomdurrant tomdurrant merged commit fcd822a into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant