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

Closing if branches #959

Open
matteo-cristino opened this issue Nov 8, 2024 · 1 comment · May be fixed by #960
Open

Closing if branches #959

matteo-cristino opened this issue Nov 8, 2024 · 1 comment · May be fixed by #960

Comments

@matteo-cristino
Copy link
Collaborator

When doing multiple if I have no way to close one and continue in the parent branching. Suppose that I have some optional parameters in input that are contained in the optional_fields dictionary, like

  • dictionary1
  • dictionary2
    that contains other optional data.
    When I have to checks if some data is present in dictionary1 I have to do
Given I have a 'string dictionary' named 'optional_fields'

# nested_optional_field_1
If I verify 'dictionary1' is found in 'optional_fields'
When I pickup from path 'optional_fields.dictionary1'
If I verify 'nested_optional_field_1' is found in 'dictionary1'
# do stuff here with your parameter
Endif

# nested_optional_field_2
If I verify 'dictionary1' is found in 'optional_fields'
When I pickup from path 'optional_fields.dictionary1'
If I verify 'nested_optional_field_1' is found in 'dictionary1'
# do stuff here with your parameter
Endif

# and so on for all nested parameters

For each parameter I have to redo all the checks while it would be nice if the Endif would close only the nearest if, such that I can continue to check for other parameters like

Given I have a 'string dictionary' named 'optional_fields'

# nested_optional_field_1
If I verify 'dictionary1' is found in 'optional_fields'
When I pickup from path 'optional_fields.dictionary1'
If I verify 'nested_optional_field_1' is found in 'dictionary1'
# do stuff here with your parameter
Endif
If I verify 'nested_optional_field_1' is found in 'dictionary1'
# do stuff here with your parameter
Endif
# other parameters
Endif # to close first if

In order to matain back compatibility the Endif can continue to kill all the branches while a new statement can be introduced to close only the closer if

@matteo-cristino
Copy link
Collaborator Author

Ops we can not do nested if branching when the if are separated from another statement. Is it something that we do not want to support?

@matteo-cristino matteo-cristino linked a pull request Nov 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant