Skip to content

Use maps instead of arrays for complex objects in the specification #831

Closed
@ricardozanini

Description

@ricardozanini

What would you like to be added:
For the long term, we should use maps (key/value) instead of arrays when listing complex objects. For example:

states:
    - name: state-1
        actions:
        - name: action-1
    - name: state-2
    - name: state-3

Although it looks fine when using tools such as JsonPointer or JSON path to find items in the definition it may pose a challenge: states/0/actions/0/functionRef. One must rely on the array to find the objects. If the flow changes and a state or action changes the original order, the queries will be jeopardized.

Instead, we can use maps:

states:
    state1:
        action1:
    state2:
    state3:

The query then can be pragmatic, order won't matter: states/state1/action1.

Additionally, implementation-wise, a few languages may not guarantee a correct order when serializing/deserializing a workflow. Using maps will definitely get rid of such a risk.

Why is this needed:
See context: #820 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions