Skip to content

Add Support for Arrays of Objects Using Indexed Parameter Names #1

@gravity-api

Description

@gravity-api

Description:

We need to extend the CLI tool's parameter parsing to support arrays of objects. The current implementation supports parsing arrays by passing the same parameter name multiple times (e.g. --ParamName:value1 --ParamName:value2) and dictionaries by using key-value pairs (e.g. --KeyValueParam:Key=Value --KeyValueParam:OtherKey=OtherValue).

Proposed Solution:

Introduce an index into the parameter name to group properties for the same object. For example, the following syntax would represent an array of objects:

--Item[0]:Key=Value --Item[0]:OtherKey=OtherValue --Item[1]:Key=Value2 --Item[1]:OtherKey=OtherValue2

In this approach:

  • Each object is identified by an index (e.g., [0], [1]).
  • All key-value pairs with the same index belong to the same object.
  • The parser should group these parameters and return an array of objects.

Acceptance Criteria:

  • Syntax:
    The CLI tool should accept parameters in the format --Item[index]:Property=Value.

  • Grouping:
    The parser must correctly group properties by their index and produce an array of objects.

  • Backward Compatibility:
    Existing functionality for arrays and dictionaries should remain unchanged.

  • Documentation:
    Update the user documentation to include the new syntax and provide examples.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions