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

Access to response results during loop #569

Closed
k2tzumi opened this issue Jul 24, 2023 · 8 comments
Closed

Access to response results during loop #569

k2tzumi opened this issue Jul 24, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@k2tzumi
Copy link
Collaborator

k2tzumi commented Jul 24, 2023

For example.

runners:
  req: https://api.example.com
steps:
  loopStep:
     loop:
      count: 10
    req:
      /odd?num={{ i }}
       get:
   referenceLoopStep:
     test: |
       steps.loopStep.loog[0].res.body.result == false  # I want to refer to the response result of each loop from another step.
       && steps.loopStep.loog[1].res.body.result == true
       && steps.loopStep.loog[2].res.body.result == false
@k1LoW
Copy link
Owner

k1LoW commented Jul 27, 2023

Maybe s/loog/loop/ ?

@k2tzumi
Copy link
Collaborator Author

k2tzumi commented Jul 27, 2023

yes. loop

@k1LoW
Copy link
Owner

k1LoW commented Jul 27, 2023

The namespace loop is not violated by anything else, and looks good to me.

On the other hand, if we can get a syntax that allows us to assign to an array with bind runner, we may be able to substitute it.

Then we would not have to increase namespace and memory usage would be limited.

runners:
  req: https://api.example.com
steps:
  loopStep:
     loop:
      count: 10
    req:
      /odd?num={{ i }}
       get:
    bind:
      'loop[i]' : current.res # ?????????
   referenceLoopStep:
     test: |
       loop[0].res.body.result == false  # I want to refer to the response result of each loop from another step.
       && loop[1].res.body.result == true
       && loop[2].res.body.result == false

But I can't imagine a good syntax.

@k2tzumi
Copy link
Collaborator Author

k2tzumi commented Jul 29, 2023

if we can get a syntax that allows us to assign to an array with bind runner, we may be able to substitute it.

I thought the idea of being able to specify a variable with a variable name at the time of binding was very good. 👍

@k1LoW k1LoW added the enhancement New feature or request label Aug 7, 2023
@k2tzumi
Copy link
Collaborator Author

k2tzumi commented Nov 25, 2023

I thought the following description would be good

runners:
  req: https://api.example.com
steps:
  loopStep:
     loop:
      count: 10
    req:
      /odd?num={{ i }}
       get:
    bind:
      "foo[]": current.res.body.foo 

@k1LoW
Copy link
Owner

k1LoW commented Nov 27, 2023

With the syntax foo[], It means to append a value, right?

I think this syntax makes it difficult to support the map, how do you think?

k1LoW added a commit that referenced this issue Nov 28, 2023
ref: #569

```yaml
bind:
  vars:
    "foo[i]": current.res
```
k1LoW added a commit that referenced this issue Nov 28, 2023
ref: #569

```yaml
bind:
  vars:
    "foo[]": current.res
```
@k1LoW
Copy link
Owner

k1LoW commented Nov 28, 2023

I tried to support two syntaxes, foo[] and foo[i] at #699.

@k2tzumi
Copy link
Collaborator Author

k2tzumi commented Nov 28, 2023

Thank you!

@k2tzumi k2tzumi closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants