Skip to content

Make null defaults nullable in Avro schema#172

Open
PhotonData-oss wants to merge 1 commit into
AbsaOSS:mainfrom
PhotonData-oss:fix-null-default-avro-schema-type
Open

Make null defaults nullable in Avro schema#172
PhotonData-oss wants to merge 1 commit into
AbsaOSS:mainfrom
PhotonData-oss:fix-null-default-avro-schema-type

Conversation

@PhotonData-oss

Copy link
Copy Markdown

Summary

  • convert fields with default=None to Avro nullable union types
  • avoid double-wrapping types that are already nullable
  • preserve default: null for optional/null-defaulted Pydantic fields
  • add a regression test for the reported boolean/null-default schema

Verification

  • git diff --cached --check
  • python -m pytest tests/test_schema.py -q using a local virtualenv with Pydantic 1.10.26

Full pytest collection was not completed in this Python 3.11 environment because unrelated tests require missing optional dependencies (tqdm, confluent_kafka) and tests/test_models.py imports Iterator from collections, which is not available on Python 3.11.

Fixes #149

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.

Schema generation of defaults is incompatible with Avro schema

2 participants