All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- kwarg typing in AvroModel (#488)
- syntax warning in FakeStub docstring (#486)
- property extra_allowed_default_types added to Field. Closes #457 (#481)
- simplify faker stub code (#471)
- add pydantic v2 support. Closes #415 (#455)
- add fake() support to Literal field type (#451)
- add support for typing.Literal (#435).
- pydantic-v2: First steps to support pydantic v2. Namespace dataclasses_avroschame.pydantic added. All AvroModel fields now are private (#427)
Migration guide for pydantic users: https://marcosschroh.github.io/dataclasses-avroschema/migration_guide/#migration-from-previous-versions-to-0510
- Add typing-extensions to python 3.8 (#432)
- Resolve issues with raw
None
annotation (#433). Closes #424
- add support for pydantic custom classes as fields (#420)
- option to exclude fields on the output schema added. (#423)
- respect enum symbols order when generating models from schemas. Related to #413 (#422)
- drop python 3.7 support (#414)
- Model/code generator when enum has namespaces. Closes #406 (#410)
- field ordering when field has metadata but not a default value. Closes #401 (#403)
- do not uppercase enums keys when the key already exist. Closes #399 (#402)
- Make Faker an optional dependency. (#391)
- dependencies updated (#393)
- record fields avro schema creation (#382) (#383)
- schema generation with optional Enum fields (#386)
- support pydantic constrained int fields (#379)
- default factory in order to get proper default values. Closes #365
- field_order property added to class Meta. Closes #345 (#369)
- pydantic fields added. Closes #328
- model generator when fields have metadata. Closes #348 (#355)
- pydantic nested schema serialization (#346)
- stringcase replaced by casefy. Closes #341 (#347)
- Fix typo in kwargs typehint for AvroBaseModel.fake (#340)
- ci process (#336)
- update dependencies and bump version (#334)
- proper schema generation when primitive types are defined types. Closes #330 (#332)
- dict conversion of AvroBaseModel. Closes #324 (#331)
- deserialization with more than tow layers. Closes #326 (#329)
- excluded pydantic.Fields should be used on avro serialization. Closes #314 (#322)
- AvroRecord added in order to make simpler faust usage. Closes #281 (#303)
- pydantic and faust-streaming optional dependencies. Remove pytz as dependency. Closes #292 (#297)
- typing: incorrect type annotations in avrodantic.py (#302)
- TupleField added in order to deserialize typing.Tuple as tuples rather than list. Closes #291 (#296)
- dev dependencies updated (#294)
- dependencies updated. Model generator documentation updated (#285)
- types.Decimal has been replaced by condecimal (Annotated[decimal.Decimal]). Closes #260 (#282)
- correctly generate enum default values (#275)
- correctly generate type annotations
fix: do not generate default dataclass docstrings
fix: datetime model generation
the previous implementation did not roundtrip
feat: render docstrings in generated classes
fix: correct union and optional conversion
test: add avsc -> python -> avsc roundtrip test
fix: properly handle aliases in the model generator
tests: add coverage for single-type unions model generation
Co-authored-by: Maximilian Hils git@maximilianhils.com
- include matadata when using pydantic.Field with AvroBaseMode. Closes #263 (#274)
- use
extras
in a correct way. Closes #272 (#273)
- dependencies updated. Closes #270 (#271)
- support for typing.Annotated added (#264)
- dc-avro dependency (#262)
- First release added with
commitizen
- Avro schema generation should always return the same result. Close #254 (#255)
- Exception
NameSpaceRequiredException
removed. Close #246 (#253)
- Dependencies and documentation (#252)
- Use
UUID
type instead of functionuuid4
on model generation (#251)
- Use
pydantic UUID4
when generating pydantic models. (#247)
- Dacite custom config added to class Meta. Closes #242 (#245)
- ListField fake generation when it contains Optional. Closes #232 (#244)
- Do not persist the schema when the parent class is not an AvroModel. Closes #241
- Model generator with only decimal fields.
- Use
pydantic.condecimal
instead of the customDecimal
as default value when generatepydantic
models
- Generate a Python module from multiple schemas 235
- Convert python models from
avsc
schemas 227
- Use namespaces when an enum is used multiple times in a class. Cases should not apply to enum names. Closes 221
- Schema generation with optional enum when using pydantic. Closes 229
- Fake generation with optional user defined types 228
Decimal
fields serialization 222
- pydantic
fake
and nested json serialization 219
- include field
metadata
when usingfaust
records 218
typing.UnionType
support added 212
- python 3.11 support added 215
- Logial types fixed. Update to
fastavro
1.7.0 214
- Nested enums serialization 211
- Use python slots
- Provide data to the fake functionality 205
- utils refactor. @dataclass decorator included in all code examples. Inheritance example added.
- UnknownType on serialization with intermediates schemas 201
- Name collision on splittes schema usage 198.
- Micro precision added to time and datetime 197.
TimeMicro
andDateTimeMicro
field types added.
typing
issues fixed 186
- Do not use name and type from metadata in avro schema 189
- Dependency
fastavro
updated to close 184
- Raise
InvalidMap
exception when aDict
has notstring
keys - Now it is possible to use
Meta.schema_doc
to set theschema documentation
- Priority ordering for record field naming fixed 176.
alias_nested_items
must have priority order- Check if exists an alias_nested_items in parent class or Meta class of own model
- Check if the schema_name is present in the Meta class of own model
- Use the default class Name (self.type.name)
- Generate correct schema name 172:
- Check if the schema_name is present in the Meta class of own model
- Check if exists an alias_nested_items in parent class or Meta class of own model
- Use the default class Name (self.type.name)
- Created nested schema resolution directly from dictionaries using
parse_obj
90
alias_nested_items
forListField
andDictField
158
- Generate wheel package 162
- bump
fastavro
from 1.4.9 to 1.4.10 - bump
inflect
from 5.3.0 to 5.4.0
types.Enum
replaced byenum.Enum
153
- Use root reference to generate valid schemas in multiple inheritance levels 148
validate
method added toAvroModel
144
- Generate valid avro schemas when inheritance has multiple levels 140
- api
get_fields
now returns all rendered fields 134
- Support for default
null
decimals added 130
Available cases:
Case | Example |
---|---|
camelcase | 'foo_bar_baz' # => "fooBarBaz" |
capitalcase | 'foo_bar_baz' # => "Foo_bar_baz" |
constcase | 'FooBarBaz' # => "_FOO_BAR_BAZ" |
lowercase | 'FooBarBaz' # => "foobarbaz" |
pascalcase | 'FooBarBaz' # => "FooBarBaz" |
pathcase | 'foo_bar_baz' # => "foo/bar/baz" |
snakecase | 'FooBarBaz' # => "foo_bar_baz" |
spinalcase | 'FooBarBaz' # => "-foo-bar-baz" |
trimcase | 'FooBarBaz' # => "FooBarBaz" |
uppercase | 'FooBarBaz' # => "FOOBARBAZ |
alphanumcase | 'Foo_123 Bar!' # =>'Foo123Bar' |
int
andfloat
Avro type support 119
- Use
namespaces
on repeated user types with complex types 117
- Use
namespaces
for repeated types in arrays and maps 116
- Use
namespaces
for repeated types 115 - Record names now are generated using
class.__name__
instead ofclass.__name__.lower()_record
- Cleanup 112
- Mitration to GithubCI
GenericAlias
test in Python3.9
- Add Python
3.8
and3.9
in theCI build
- Add
schema_name
attribute toSchemaMetadata
- Add optional writer_schema in
deserialization
- Unpin install_requires with version ranges 99
- Improve error message in unknown type: marcosschroh#88
- dependencies updated
- avro-json serialization with defaults 89
- Correct out-of-spec Avro schemas with typing.Union #87
- Support for decimal logical type added #86
- Default Avro type for Python ints has been changed from
int
tolong
andfloat
todouble
83. Reason:- Integers have unlimited precision
- Floating point numbers are usually implemented using
double
in C - almost all platforms map Python floats to IEEE-754
double
precision
- Allow multiple references to the same class in record relationships
- Correct name generation for nested records 81
- Fake instances generation added
- Deserialization process generate class instances instead a pythn dict
- In order to get a python dict in the deserialiation process the flag
create_instance=False
should be used - Example with usage with kafka drivers added
pytz
added as requirement
UUID
type fixed
- replaced
null
string withavro null
(json) - code improvement
SelfReferenceField
when is used innarray
andmaps
SelfReferenceField
default value fixed
null
should not be included when a default value is defined for premitive types
typing.Optional
union fixedtyping.Union
with complex types (sequeces and Dict) fixed
- documentation of
dataclasses.field
descriptor added - support for aware datetime added
serialization
fixed for complex types
to_json
method fixed. issue 47
- bytes type fixed
- null with Schema Logical Types and Relationships supported
- inheritance approach adopted over composition
- SchemaGenerator class
enum
type now is represented bytypes.Enum
- json payload generated from class instance
- import of SchemaGenetor improved
- Documentation updated
- Serialization/deserialization added
- fixed type support
- Ability to store metadata into fields
- More type checks
- isort package added
- Support
typing.Optional
added
- Union types can be included in sequences types
- Logical types now are allowed in Sequences and Maps
- Union type now allows logical and primitive types
- Support for Sequences and Mappings added
Avro Type | Python Type |
---|---|
arrays | typing.Sequence, typing.MutableSequence |
maps | typing.Mapping, typing.MutableMapping |
- Faust support: Now is possible to generate Avro Schemas from a Faust Records
- Now default values are validated according to the field type
- Avro Union support added
- Support for some logical types
Avro Type | Logical Type | Python Type |
---|---|---|
int | date | datetime.date |
int | time-millis | datetime.time |
long | timestamp-millis | datetime.datetime |
string | uuid | uuid.uuid4 |
- Code refactor: Field have been devided into several field classes to make the code more redeable
- Recursive Schema Relationships:
- Recursive OneToOne relationship added
- Recursive OneToMany relationship added
- Code refator and improvements
- Singular name for array's child name
- Singular name for map's child name
- Singular name for nested relationship OneToMany
- Schema Relationships:
- OneToOne relationship added
- OneToMany relationship added (array and map)
- Enum, Array and Map fields fixed
- Schema Parse tests added using fastavro
- First release