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

Fix schema generation with optional Enum fields #386

Merged

Conversation

michal-rogala
Copy link
Contributor

This is a fix to #380 where optional Enum field with default value generates invalid Avro schema.

Root cause was the fact that for enum (and probably others) - field type is either full definition or a reference string (if full definition was already emitted) which was not accounted for when comparing lists of fields internally in this library.

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #386 (236ef78) into master (18e942e) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 236ef78 differs from pull request most recent head 605c352. Consider uploading reports for the commit 605c352 to get more accurate results

@@           Coverage Diff           @@
##           master     #386   +/-   ##
=======================================
  Coverage   99.26%   99.26%           
=======================================
  Files          20       20           
  Lines        1487     1487           
  Branches      271      271           
=======================================
  Hits         1476     1476           
  Misses          3        3           
  Partials        8        8           
Files Changed Coverage Δ
dataclasses_avroschema/fields/fields.py 98.99% <100.00%> (ø)

@marcosschroh marcosschroh merged commit 6a1f6c1 into marcosschroh:master Aug 14, 2023
7 of 8 checks passed
marcosschroh added a commit that referenced this pull request Aug 14, 2023
* fix enum schema generation

* format code

* add default value to dict get

* format files

* different approach to field comparison

---------

Co-authored-by: Marcos Schroh <2828842+marcosschroh@users.noreply.github.com>
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.

None yet

2 participants