From d74b53be5b426a1ec44575203cf9ee85545bd53a Mon Sep 17 00:00:00 2001 From: Koudai Aono Date: Thu, 4 Jun 2026 06:29:41 +0000 Subject: [PATCH] Fix Avro required defaults --- src/datamodel_code_generator/__init__.py | 5 +--- .../parser/asyncapi.py | 28 ++--------------- src/datamodel_code_generator/parser/avro.py | 4 --- .../main/asyncapi/multi_format_schemas.py | 4 +-- .../expected/main/avro/py310/constructs.py | 16 +++++----- .../main/avro/py310/official_long_list.py | 2 +- .../record_fields_with_defaults.py | 2 +- .../expected/main/avro/py310/spec_matrix.py | 30 +++++++++---------- .../expected/main/avro/py311/constructs.py | 16 +++++----- .../main/avro/py311/official_long_list.py | 2 +- .../record_fields_with_defaults.py | 2 +- .../expected/main/avro/py311/spec_matrix.py | 30 +++++++++---------- .../expected/main/avro/py312/constructs.py | 16 +++++----- .../main/avro/py312/official_long_list.py | 2 +- .../record_fields_with_defaults.py | 2 +- .../expected/main/avro/py312/spec_matrix.py | 30 +++++++++---------- .../expected/main/avro/py313/constructs.py | 16 +++++----- .../main/avro/py313/official_long_list.py | 2 +- .../record_fields_with_defaults.py | 2 +- .../expected/main/avro/py313/spec_matrix.py | 30 +++++++++---------- .../expected/main/avro/py314/constructs.py | 16 +++++----- .../main/avro/py314/official_long_list.py | 2 +- .../record_fields_with_defaults.py | 2 +- .../expected/main/avro/py314/spec_matrix.py | 30 +++++++++---------- 24 files changed, 131 insertions(+), 160 deletions(-) diff --git a/src/datamodel_code_generator/__init__.py b/src/datamodel_code_generator/__init__.py index dc9c23ac4..a1034ee0d 100644 --- a/src/datamodel_code_generator/__init__.py +++ b/src/datamodel_code_generator/__init__.py @@ -965,10 +965,7 @@ def load_mcp_tools_data() -> Any: from datamodel_code_generator.config import AvroParserConfig # noqa: PLC0415 from datamodel_code_generator.parser.avro import AvroParser # noqa: PLC0415 - avro_additional_options: AvroParserConfigDict = { - "apply_default_values_for_required_fields": True, - **additional_options, - } + avro_additional_options: AvroParserConfigDict = {**additional_options} parser_config = _create_parser_config(AvroParserConfig, config, avro_additional_options) parser = AvroParser(source=source, config=parser_config) # ty: ignore elif input_file_type == InputFileType.GraphQL: diff --git a/src/datamodel_code_generator/parser/asyncapi.py b/src/datamodel_code_generator/parser/asyncapi.py index 6c0497fbd..63ef30908 100644 --- a/src/datamodel_code_generator/parser/asyncapi.py +++ b/src/datamodel_code_generator/parser/asyncapi.py @@ -8,7 +8,7 @@ import re from contextlib import contextmanager -from dataclasses import dataclass, replace +from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Any, ClassVar @@ -105,7 +105,6 @@ class AsyncAPISchema: path: list[str] context: AsyncAPIContext parse_as_file: bool = False - apply_avro_default_values: bool = False class MultiFormatSchemaObject(BaseModel): @@ -291,19 +290,6 @@ def _schema( parse_as_file=parse_as_file, ) - @contextmanager - def _avro_default_values(self, *, enabled: bool) -> Iterator[None]: - if not enabled: - yield - return - - previous = self.apply_default_values_for_required_fields - self.apply_default_values_for_required_fields = True - try: - yield - finally: - self.apply_default_values_for_required_fields = previous - def _schema_context_for_converted_schema( self, converted_schema: dict[str, YamlValue], @@ -378,12 +364,7 @@ def _iter_schema_format_schemas( converted_schema = convert_avro_schema_data(raw_schema) converted_schema.setdefault("title", name) context = self._schema_context_for_converted_schema(converted_schema, path) - return [ - replace( - self._schema(name, converted_schema, context.root_parts, context, parse_as_file=True), - apply_avro_default_values=True, - ) - ] + return [self._schema(name, converted_schema, context.root_parts, context, parse_as_file=True)] case "protobuf": context = self._current_asyncapi_context() return self._iter_converted_schema_schemas( @@ -1004,10 +985,7 @@ def parse_raw(self) -> None: if path_key in parsed_paths: continue parsed_paths.add(path_key) - with ( - self._asyncapi_context(schema.context), - self._avro_default_values(enabled=schema.apply_avro_default_values), - ): + with self._asyncapi_context(schema.context): if schema.parse_as_file: self._parse_file(raw_schema, schema.name, schema.path) else: diff --git a/src/datamodel_code_generator/parser/avro.py b/src/datamodel_code_generator/parser/avro.py index 2fccd2fc5..9cc861c47 100644 --- a/src/datamodel_code_generator/parser/avro.py +++ b/src/datamodel_code_generator/parser/avro.py @@ -421,8 +421,6 @@ def _convert_record(self, schema: JsonSchema, fullname: str) -> JsonSchema: field_schema["x-avro-aliases"] = field["aliases"] if "order" in field: field_schema["x-avro-order"] = field["order"] - if "default" in field: - field_schema["default"] = field["default"] required.append(field_name) properties[field_name] = field_schema @@ -452,8 +450,6 @@ def _convert_enum(self, schema: JsonSchema, fullname: str) -> JsonSchema: seen_symbols.add(symbol) converted: JsonSchema = {"type": "string", "enum": symbols} self._copy_common_metadata(schema, converted) - if "default" in schema: - converted["default"] = schema["default"] converted["x-avro-fullname"] = fullname return converted diff --git a/tests/data/expected/main/asyncapi/multi_format_schemas.py b/tests/data/expected/main/asyncapi/multi_format_schemas.py index 4edb30eb7..b38c59b0e 100644 --- a/tests/data/expected/main/asyncapi/multi_format_schemas.py +++ b/tests/data/expected/main/asyncapi/multi_format_schemas.py @@ -13,8 +13,8 @@ class UserStatus(BaseModel): class UserSignupUserSignupPayload(BaseModel): displayName: str - age: int | None = None - signupCount: int = 0 + age: int | None + signupCount: int class UserSignupUserSignupHeaders(BaseModel): diff --git a/tests/data/expected/main/avro/py310/constructs.py b/tests/data/expected/main/avro/py310/constructs.py index b07e96225..8bf8ea5bf 100644 --- a/tests/data/expected/main/avro/py310/constructs.py +++ b/tests/data/expected/main/avro/py310/constructs.py @@ -19,7 +19,7 @@ class Status(Enum): class Address(BaseModel): street: str - zip: str | None = None + zip: str | None class MD5(RootModel[conbytes(min_length=16, max_length=16)]): @@ -43,17 +43,17 @@ class User(BaseModel): """ Stable identifier """ - active: bool = True - age: int = 0 + active: bool + age: int visits: int score: float rating: float payload: bytes - status: Status = 'ACTIVE' - tags: list[str] = [] - attributes: dict[str, str] = {} + status: Status + tags: list[str] + attributes: dict[str, str] address: Address - previous: User | None = None + previous: User | None hash: MD5 traceId: TraceId price: Decimal @@ -69,7 +69,7 @@ class User(BaseModel): localUpdatedAt: NaiveDatetime localProcessedAt: NaiveDatetime duration: Duration - choice: str | int | None = None + choice: str | int | None rawDecimalText: str diff --git a/tests/data/expected/main/avro/py310/official_long_list.py b/tests/data/expected/main/avro/py310/official_long_list.py index 419df35b3..c74fd9fce 100644 --- a/tests/data/expected/main/avro/py310/official_long_list.py +++ b/tests/data/expected/main/avro/py310/official_long_list.py @@ -9,7 +9,7 @@ class LongList(BaseModel): value: int - next: LongList | None = None + next: LongList | None LongList.model_rebuild() diff --git a/tests/data/expected/main/avro/py310/official_schema_pass/record_fields_with_defaults.py b/tests/data/expected/main/avro/py310/official_schema_pass/record_fields_with_defaults.py index 7df5a24d5..088c4c69f 100644 --- a/tests/data/expected/main/avro/py310/official_schema_pass/record_fields_with_defaults.py +++ b/tests/data/expected/main/avro/py310/official_schema_pass/record_fields_with_defaults.py @@ -11,4 +11,4 @@ class Person(BaseModel): height: int weight: int name: str - hacker: bool = False + hacker: bool diff --git a/tests/data/expected/main/avro/py310/spec_matrix.py b/tests/data/expected/main/avro/py310/spec_matrix.py index 6500b490f..43cacc3a8 100644 --- a/tests/data/expected/main/avro/py310/spec_matrix.py +++ b/tests/data/expected/main/avro/py310/spec_matrix.py @@ -11,7 +11,7 @@ class DefaultRecord(BaseModel): - value: int = 1 + value: int class DefaultEnum(Enum): @@ -75,22 +75,22 @@ class Array(BaseModel): class SpecMatrix(BaseModel): - nullDefault: None = None - booleanDefault: bool = False - intDefault: int = 1 - longDefault: int = 2 - floatDefault: float = 1.5 - doubleDefault: float = 2.5 - bytesDefault: bytes = 'ÿ' - stringDefault: str = 'foo' - recordDefault: DefaultRecord = Field({'value': 1}, validate_default=True) - enumDefault: DefaultEnum = 'FOO' - arrayDefault: list[int] = [1] - mapDefault: dict[str, int] = {'a': 1} - fixedDefault: DefaultFixed = Field('ÿ', validate_default=True) + nullDefault: None + booleanDefault: bool + intDefault: int + longDefault: int + floatDefault: float + doubleDefault: float + bytesDefault: bytes + stringDefault: str + recordDefault: DefaultRecord + enumDefault: DefaultEnum + arrayDefault: list[int] + mapDefault: dict[str, int] + fixedDefault: DefaultFixed ascendingOrder: str descendingOrder: str - nullableAfterValue: str | None = 'value' + nullableAfterValue: str | None sameKindNamedUnion: RA | RB | EA | EB | FA | FB arrayOfRecords: list[ArrayItem] mapOfEnums: dict[str, MapValue] diff --git a/tests/data/expected/main/avro/py311/constructs.py b/tests/data/expected/main/avro/py311/constructs.py index 9b016a1a8..d3be18877 100644 --- a/tests/data/expected/main/avro/py311/constructs.py +++ b/tests/data/expected/main/avro/py311/constructs.py @@ -19,7 +19,7 @@ class Status(StrEnum): class Address(BaseModel): street: str - zip: str | None = None + zip: str | None class MD5(RootModel[conbytes(min_length=16, max_length=16)]): @@ -43,17 +43,17 @@ class User(BaseModel): """ Stable identifier """ - active: bool = True - age: int = 0 + active: bool + age: int visits: int score: float rating: float payload: bytes - status: Status = 'ACTIVE' - tags: list[str] = [] - attributes: dict[str, str] = {} + status: Status + tags: list[str] + attributes: dict[str, str] address: Address - previous: User | None = None + previous: User | None hash: MD5 traceId: TraceId price: Decimal @@ -69,7 +69,7 @@ class User(BaseModel): localUpdatedAt: NaiveDatetime localProcessedAt: NaiveDatetime duration: Duration - choice: str | int | None = None + choice: str | int | None rawDecimalText: str diff --git a/tests/data/expected/main/avro/py311/official_long_list.py b/tests/data/expected/main/avro/py311/official_long_list.py index 419df35b3..c74fd9fce 100644 --- a/tests/data/expected/main/avro/py311/official_long_list.py +++ b/tests/data/expected/main/avro/py311/official_long_list.py @@ -9,7 +9,7 @@ class LongList(BaseModel): value: int - next: LongList | None = None + next: LongList | None LongList.model_rebuild() diff --git a/tests/data/expected/main/avro/py311/official_schema_pass/record_fields_with_defaults.py b/tests/data/expected/main/avro/py311/official_schema_pass/record_fields_with_defaults.py index 7df5a24d5..088c4c69f 100644 --- a/tests/data/expected/main/avro/py311/official_schema_pass/record_fields_with_defaults.py +++ b/tests/data/expected/main/avro/py311/official_schema_pass/record_fields_with_defaults.py @@ -11,4 +11,4 @@ class Person(BaseModel): height: int weight: int name: str - hacker: bool = False + hacker: bool diff --git a/tests/data/expected/main/avro/py311/spec_matrix.py b/tests/data/expected/main/avro/py311/spec_matrix.py index 63da87383..c192a930e 100644 --- a/tests/data/expected/main/avro/py311/spec_matrix.py +++ b/tests/data/expected/main/avro/py311/spec_matrix.py @@ -11,7 +11,7 @@ class DefaultRecord(BaseModel): - value: int = 1 + value: int class DefaultEnum(StrEnum): @@ -75,22 +75,22 @@ class Array(BaseModel): class SpecMatrix(BaseModel): - nullDefault: None = None - booleanDefault: bool = False - intDefault: int = 1 - longDefault: int = 2 - floatDefault: float = 1.5 - doubleDefault: float = 2.5 - bytesDefault: bytes = 'ÿ' - stringDefault: str = 'foo' - recordDefault: DefaultRecord = Field({'value': 1}, validate_default=True) - enumDefault: DefaultEnum = 'FOO' - arrayDefault: list[int] = [1] - mapDefault: dict[str, int] = {'a': 1} - fixedDefault: DefaultFixed = Field('ÿ', validate_default=True) + nullDefault: None + booleanDefault: bool + intDefault: int + longDefault: int + floatDefault: float + doubleDefault: float + bytesDefault: bytes + stringDefault: str + recordDefault: DefaultRecord + enumDefault: DefaultEnum + arrayDefault: list[int] + mapDefault: dict[str, int] + fixedDefault: DefaultFixed ascendingOrder: str descendingOrder: str - nullableAfterValue: str | None = 'value' + nullableAfterValue: str | None sameKindNamedUnion: RA | RB | EA | EB | FA | FB arrayOfRecords: list[ArrayItem] mapOfEnums: dict[str, MapValue] diff --git a/tests/data/expected/main/avro/py312/constructs.py b/tests/data/expected/main/avro/py312/constructs.py index 9b016a1a8..d3be18877 100644 --- a/tests/data/expected/main/avro/py312/constructs.py +++ b/tests/data/expected/main/avro/py312/constructs.py @@ -19,7 +19,7 @@ class Status(StrEnum): class Address(BaseModel): street: str - zip: str | None = None + zip: str | None class MD5(RootModel[conbytes(min_length=16, max_length=16)]): @@ -43,17 +43,17 @@ class User(BaseModel): """ Stable identifier """ - active: bool = True - age: int = 0 + active: bool + age: int visits: int score: float rating: float payload: bytes - status: Status = 'ACTIVE' - tags: list[str] = [] - attributes: dict[str, str] = {} + status: Status + tags: list[str] + attributes: dict[str, str] address: Address - previous: User | None = None + previous: User | None hash: MD5 traceId: TraceId price: Decimal @@ -69,7 +69,7 @@ class User(BaseModel): localUpdatedAt: NaiveDatetime localProcessedAt: NaiveDatetime duration: Duration - choice: str | int | None = None + choice: str | int | None rawDecimalText: str diff --git a/tests/data/expected/main/avro/py312/official_long_list.py b/tests/data/expected/main/avro/py312/official_long_list.py index 419df35b3..c74fd9fce 100644 --- a/tests/data/expected/main/avro/py312/official_long_list.py +++ b/tests/data/expected/main/avro/py312/official_long_list.py @@ -9,7 +9,7 @@ class LongList(BaseModel): value: int - next: LongList | None = None + next: LongList | None LongList.model_rebuild() diff --git a/tests/data/expected/main/avro/py312/official_schema_pass/record_fields_with_defaults.py b/tests/data/expected/main/avro/py312/official_schema_pass/record_fields_with_defaults.py index 7df5a24d5..088c4c69f 100644 --- a/tests/data/expected/main/avro/py312/official_schema_pass/record_fields_with_defaults.py +++ b/tests/data/expected/main/avro/py312/official_schema_pass/record_fields_with_defaults.py @@ -11,4 +11,4 @@ class Person(BaseModel): height: int weight: int name: str - hacker: bool = False + hacker: bool diff --git a/tests/data/expected/main/avro/py312/spec_matrix.py b/tests/data/expected/main/avro/py312/spec_matrix.py index 63da87383..c192a930e 100644 --- a/tests/data/expected/main/avro/py312/spec_matrix.py +++ b/tests/data/expected/main/avro/py312/spec_matrix.py @@ -11,7 +11,7 @@ class DefaultRecord(BaseModel): - value: int = 1 + value: int class DefaultEnum(StrEnum): @@ -75,22 +75,22 @@ class Array(BaseModel): class SpecMatrix(BaseModel): - nullDefault: None = None - booleanDefault: bool = False - intDefault: int = 1 - longDefault: int = 2 - floatDefault: float = 1.5 - doubleDefault: float = 2.5 - bytesDefault: bytes = 'ÿ' - stringDefault: str = 'foo' - recordDefault: DefaultRecord = Field({'value': 1}, validate_default=True) - enumDefault: DefaultEnum = 'FOO' - arrayDefault: list[int] = [1] - mapDefault: dict[str, int] = {'a': 1} - fixedDefault: DefaultFixed = Field('ÿ', validate_default=True) + nullDefault: None + booleanDefault: bool + intDefault: int + longDefault: int + floatDefault: float + doubleDefault: float + bytesDefault: bytes + stringDefault: str + recordDefault: DefaultRecord + enumDefault: DefaultEnum + arrayDefault: list[int] + mapDefault: dict[str, int] + fixedDefault: DefaultFixed ascendingOrder: str descendingOrder: str - nullableAfterValue: str | None = 'value' + nullableAfterValue: str | None sameKindNamedUnion: RA | RB | EA | EB | FA | FB arrayOfRecords: list[ArrayItem] mapOfEnums: dict[str, MapValue] diff --git a/tests/data/expected/main/avro/py313/constructs.py b/tests/data/expected/main/avro/py313/constructs.py index 9b016a1a8..d3be18877 100644 --- a/tests/data/expected/main/avro/py313/constructs.py +++ b/tests/data/expected/main/avro/py313/constructs.py @@ -19,7 +19,7 @@ class Status(StrEnum): class Address(BaseModel): street: str - zip: str | None = None + zip: str | None class MD5(RootModel[conbytes(min_length=16, max_length=16)]): @@ -43,17 +43,17 @@ class User(BaseModel): """ Stable identifier """ - active: bool = True - age: int = 0 + active: bool + age: int visits: int score: float rating: float payload: bytes - status: Status = 'ACTIVE' - tags: list[str] = [] - attributes: dict[str, str] = {} + status: Status + tags: list[str] + attributes: dict[str, str] address: Address - previous: User | None = None + previous: User | None hash: MD5 traceId: TraceId price: Decimal @@ -69,7 +69,7 @@ class User(BaseModel): localUpdatedAt: NaiveDatetime localProcessedAt: NaiveDatetime duration: Duration - choice: str | int | None = None + choice: str | int | None rawDecimalText: str diff --git a/tests/data/expected/main/avro/py313/official_long_list.py b/tests/data/expected/main/avro/py313/official_long_list.py index 419df35b3..c74fd9fce 100644 --- a/tests/data/expected/main/avro/py313/official_long_list.py +++ b/tests/data/expected/main/avro/py313/official_long_list.py @@ -9,7 +9,7 @@ class LongList(BaseModel): value: int - next: LongList | None = None + next: LongList | None LongList.model_rebuild() diff --git a/tests/data/expected/main/avro/py313/official_schema_pass/record_fields_with_defaults.py b/tests/data/expected/main/avro/py313/official_schema_pass/record_fields_with_defaults.py index 7df5a24d5..088c4c69f 100644 --- a/tests/data/expected/main/avro/py313/official_schema_pass/record_fields_with_defaults.py +++ b/tests/data/expected/main/avro/py313/official_schema_pass/record_fields_with_defaults.py @@ -11,4 +11,4 @@ class Person(BaseModel): height: int weight: int name: str - hacker: bool = False + hacker: bool diff --git a/tests/data/expected/main/avro/py313/spec_matrix.py b/tests/data/expected/main/avro/py313/spec_matrix.py index 63da87383..c192a930e 100644 --- a/tests/data/expected/main/avro/py313/spec_matrix.py +++ b/tests/data/expected/main/avro/py313/spec_matrix.py @@ -11,7 +11,7 @@ class DefaultRecord(BaseModel): - value: int = 1 + value: int class DefaultEnum(StrEnum): @@ -75,22 +75,22 @@ class Array(BaseModel): class SpecMatrix(BaseModel): - nullDefault: None = None - booleanDefault: bool = False - intDefault: int = 1 - longDefault: int = 2 - floatDefault: float = 1.5 - doubleDefault: float = 2.5 - bytesDefault: bytes = 'ÿ' - stringDefault: str = 'foo' - recordDefault: DefaultRecord = Field({'value': 1}, validate_default=True) - enumDefault: DefaultEnum = 'FOO' - arrayDefault: list[int] = [1] - mapDefault: dict[str, int] = {'a': 1} - fixedDefault: DefaultFixed = Field('ÿ', validate_default=True) + nullDefault: None + booleanDefault: bool + intDefault: int + longDefault: int + floatDefault: float + doubleDefault: float + bytesDefault: bytes + stringDefault: str + recordDefault: DefaultRecord + enumDefault: DefaultEnum + arrayDefault: list[int] + mapDefault: dict[str, int] + fixedDefault: DefaultFixed ascendingOrder: str descendingOrder: str - nullableAfterValue: str | None = 'value' + nullableAfterValue: str | None sameKindNamedUnion: RA | RB | EA | EB | FA | FB arrayOfRecords: list[ArrayItem] mapOfEnums: dict[str, MapValue] diff --git a/tests/data/expected/main/avro/py314/constructs.py b/tests/data/expected/main/avro/py314/constructs.py index fe47d9f7d..967be347f 100644 --- a/tests/data/expected/main/avro/py314/constructs.py +++ b/tests/data/expected/main/avro/py314/constructs.py @@ -17,7 +17,7 @@ class Status(StrEnum): class Address(BaseModel): street: str - zip: str | None = None + zip: str | None class MD5(RootModel[conbytes(min_length=16, max_length=16)]): @@ -41,17 +41,17 @@ class User(BaseModel): """ Stable identifier """ - active: bool = True - age: int = 0 + active: bool + age: int visits: int score: float rating: float payload: bytes - status: Status = 'ACTIVE' - tags: list[str] = [] - attributes: dict[str, str] = {} + status: Status + tags: list[str] + attributes: dict[str, str] address: Address - previous: User | None = None + previous: User | None hash: MD5 traceId: TraceId price: Decimal @@ -67,7 +67,7 @@ class User(BaseModel): localUpdatedAt: NaiveDatetime localProcessedAt: NaiveDatetime duration: Duration - choice: str | int | None = None + choice: str | int | None rawDecimalText: str diff --git a/tests/data/expected/main/avro/py314/official_long_list.py b/tests/data/expected/main/avro/py314/official_long_list.py index 1587aaaf5..6e0063fef 100644 --- a/tests/data/expected/main/avro/py314/official_long_list.py +++ b/tests/data/expected/main/avro/py314/official_long_list.py @@ -7,7 +7,7 @@ class LongList(BaseModel): value: int - next: LongList | None = None + next: LongList | None LongList.model_rebuild() diff --git a/tests/data/expected/main/avro/py314/official_schema_pass/record_fields_with_defaults.py b/tests/data/expected/main/avro/py314/official_schema_pass/record_fields_with_defaults.py index 945f57440..10646bae1 100644 --- a/tests/data/expected/main/avro/py314/official_schema_pass/record_fields_with_defaults.py +++ b/tests/data/expected/main/avro/py314/official_schema_pass/record_fields_with_defaults.py @@ -9,4 +9,4 @@ class Person(BaseModel): height: int weight: int name: str - hacker: bool = False + hacker: bool diff --git a/tests/data/expected/main/avro/py314/spec_matrix.py b/tests/data/expected/main/avro/py314/spec_matrix.py index 664fd9994..0d7956d56 100644 --- a/tests/data/expected/main/avro/py314/spec_matrix.py +++ b/tests/data/expected/main/avro/py314/spec_matrix.py @@ -9,7 +9,7 @@ class DefaultRecord(BaseModel): - value: int = 1 + value: int class DefaultEnum(StrEnum): @@ -73,22 +73,22 @@ class Array(BaseModel): class SpecMatrix(BaseModel): - nullDefault: None = None - booleanDefault: bool = False - intDefault: int = 1 - longDefault: int = 2 - floatDefault: float = 1.5 - doubleDefault: float = 2.5 - bytesDefault: bytes = 'ÿ' - stringDefault: str = 'foo' - recordDefault: DefaultRecord = Field({'value': 1}, validate_default=True) - enumDefault: DefaultEnum = 'FOO' - arrayDefault: list[int] = [1] - mapDefault: dict[str, int] = {'a': 1} - fixedDefault: DefaultFixed = Field('ÿ', validate_default=True) + nullDefault: None + booleanDefault: bool + intDefault: int + longDefault: int + floatDefault: float + doubleDefault: float + bytesDefault: bytes + stringDefault: str + recordDefault: DefaultRecord + enumDefault: DefaultEnum + arrayDefault: list[int] + mapDefault: dict[str, int] + fixedDefault: DefaultFixed ascendingOrder: str descendingOrder: str - nullableAfterValue: str | None = 'value' + nullableAfterValue: str | None sameKindNamedUnion: RA | RB | EA | EB | FA | FB arrayOfRecords: list[ArrayItem] mapOfEnums: dict[str, MapValue]