-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Describe the problem
The is_array property is defined in the codebase to determine whether a data type is an array:
@property
def is_array(self) -> bool:
# an occurrence of more than 1 marks an array
return self.max_occurs > 1
However, in several parts of the code, instead of using particle.is_array, the condition particle.max_occurs > 1 is used directly. This inconsistency can lead to maintenance issues and makes it harder to modify the criteria for what qualifies as an array in the future.
Additionally, I am adapting this project for compatibility with OpenV2G, which considers "unbounded" data types with a max occurrence limited to 1 as arrays of length 1, while cbexigen currently treats them as simple elements. A centralized approach using is_array would facilitate handling such differences.
Describe your solution
The code should consistently use is_array instead of directly checking max_occurs > 1. This would improve maintainability and make future modifications to array detection easier. If the definition of an array needs to change in the future, having a centralized property will ensure that the change propagates correctly throughout the codebase.
Additional context
I will send you a pull request with the proposed changes.
Thank you for all your amazing work on this library! :))