Skip to content

Add executeSequence route and function #54

@drewg2009

Description

@drewg2009

This one might be a tricky one but very powerful.

Let's say I want to perform multiple checks on a value but only given certain conditions.

And let's say the conditions are based on the previous validation results.

For example:

Given the input myemail@gmail.com I want to get the domain of the email.

But I only want the domain if it's a valid email address and if the prefix has an odd amount of characters before the @ sign.

The caller of the API could implement this logic client side...

Or...

what if the API could do it for them?

So what if we could pass an API input like the following: (pseudocode below)

{
inputString: "myemail@gmail.com",
sequence: [
{
  "run": "validateEmail"
},
{
  "run": "characterCount",
 "input": "previousValue" // this would pull the previous input value
 "if": "previousResult" // would run only if the previous result evaluates to true
},
{
  "run": "characterCount",
 "input": "previousValue" // this would pull the previous input value
 "if-equals": ["previousResult" % 2 == 0, "false"]
}, 
{
"run": "domainSuffix
"input": "previousValue", 
"if-equals": "true
}
]

}

This could start as something simpler and evolve as needed. Basically it's allowing for batch calls with conditions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions