Skip to content

Inconsistent Use of is_array Property Across Codebase #107

Description

@andcaspe

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! :))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions