From d8fe98639aaeba2e6e5f22478c74a2247556beac Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Fri, 28 Nov 2025 18:28:49 -0300 Subject: [PATCH] fix: fixes annotation definition in anyof parser --- jambo/parser/anyof_type_parser.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jambo/parser/anyof_type_parser.py b/jambo/parser/anyof_type_parser.py index c0295ff..1cca751 100644 --- a/jambo/parser/anyof_type_parser.py +++ b/jambo/parser/anyof_type_parser.py @@ -42,8 +42,12 @@ class AnyOfTypeParser(GenericTypeParser): # By defining the type as Union of Annotated type we can use the Field validator # to enforce the constraints of each union type when needed. # We use Annotated to attach the Field validators to the type. - field_types = [ - Annotated[t, Field(**v)] if v is not None else t for t, v in sub_types - ] + field_types = [] + for subType, subProp in sub_types: + default_value = subProp.pop("default", None) + if default_value is None: + default_value = ... + + field_types.append(Annotated[subType, Field(default_value, **subProp)]) return Union[(*field_types,)], mapped_properties -- 2.49.1