Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for typing.Literal #435

Conversation

OffByOnee
Copy link
Contributor

This change adds support for fields annotated with typing.Literal in line with PEP 586. It also adds support for dictionaries annotated with a key whose type is a class derived from str (e.g. StrEnum) and adds verbosity to exception messages to help with debugging (particularly in nested models when it's difficult to identify the problem field).

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Merging #435 (f873f8c) into master (3304b64) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #435   +/-   ##
=======================================
  Coverage   99.29%   99.30%           
=======================================
  Files          26       26           
  Lines        1560     1578   +18     
  Branches      285      289    +4     
=======================================
+ Hits         1549     1567   +18     
  Misses          3        3           
  Partials        8        8           
Files Coverage Δ
dataclasses_avroschema/fields/base.py 100.00% <100.00%> (ø)
dataclasses_avroschema/fields/fields.py 99.07% <100.00%> (+0.03%) ⬆️
dataclasses_avroschema/pydantic/fields.py 98.55% <100.00%> (ø)

@OffByOnee
Copy link
Contributor Author

@marcosschroh unable to add you as a reviewer, so doing a manual ping. Whenever you have time

dataclasses_avroschema/schema_generator.py Outdated Show resolved Hide resolved
dataclasses_avroschema/fields/fields.py Outdated Show resolved Hide resolved
dataclasses_avroschema/fields/base.py Outdated Show resolved Hide resolved
dataclasses_avroschema/fields/fields.py Outdated Show resolved Hide resolved
dataclasses_avroschema/pydantic/main.py Outdated Show resolved Hide resolved
Copy link
Owner

@marcosschroh marcosschroh left a comment

Choose a reason for hiding this comment

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

Excellen @OffByOnee. Thanks for your hard work!

@marcosschroh marcosschroh merged commit e57a03a into marcosschroh:master Sep 28, 2023
7 of 8 checks passed
@OffByOnee
Copy link
Contributor Author

Excellen @OffByOnee. Thanks for your hard work!

@marcosschroh sure thing! Thanks for walking me through the changes.

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.

2 participants