Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ricardozanini opened this issue Mar 14, 2024 · 3 comments
Closed
Assignees
Milestone

Comments

@ricardozanini
Copy link
Member

ricardozanini commented Mar 14, 2024

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)

@cdavernas
Copy link
Member

On a side note, we will I believe need to remove naming restrictions on actions and states, as they will be naturally enforced by property naming rules.

@cdavernas cdavernas added this to the v0.9 milestone Mar 20, 2024
Copy link

github-actions bot commented May 5, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@cdavernas
Copy link
Member

cdavernas commented May 17, 2024

This has been addressed in 1.0.0-alpha1, and is closed as part of #843

@github-project-automation github-project-automation bot moved this from Todo to Done in Progress Tracker May 17, 2024
This was referenced May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants