Skip to content

Commit

Permalink
Avoid reseting required flag on xs:attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Feb 25, 2023
1 parent 3f8af45 commit 8df7d54
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions xsdata/codegen/handlers/sanitize_attributes_default_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,14 @@ def should_reset_required(cls, attr: Attr) -> bool:
"""
Return whether the min occurrences for the attr needs to be reset.
Cases:
1. xs:any(Simple)Type, with no default value that's not a list already!
@Todo figure out if wildcards are supposed to be optional!
"""
return attr.default is None and object in attr.native_types and not attr.is_list
return (
not attr.is_attribute
and attr.default is None
and object in attr.native_types
and not attr.is_list
)

@classmethod
def should_reset_default(cls, attr: Attr) -> bool:
Expand Down

0 comments on commit 8df7d54

Please sign in to comment.