Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Resource Parameter Conditional Processing #761

Open
rspremulli-sf opened this issue Jul 3, 2021 · 0 comments
Open

Resource Parameter Conditional Processing #761

rspremulli-sf opened this issue Jul 3, 2021 · 0 comments

Comments

@rspremulli-sf
Copy link

Use case: Simple conditional processing is necessary for resource parameters. There are multiple use cases for this.

  1. Preventing content if a resource parameter is not provided "". For example, if I have a trait that has an id parameter fooId and a second id parameter barId, not all of the resources leveraging this trait might need a barId.
  2. Being able to alter descriptions to accurately describe the behavior of a response or body, with controls to form better English responses.
  3. Having default value support and the ability to detect a non-default value
  4. Being able to restrict the values allowed to be passed as parameters. For example, for a parameter intended to be used as a number, exclude strings and require the number to be less than 10000
  5. Have the ability to create new variables from parameters. For example, if I have a property that represents a URL https://<<param>>mulesoft.com/, if I pass param as 'subdomain' I would want to append a period to that to make https://subdomain.mulesoft.com/. if I pass "", indicating I do not want a subdomain, then I don't want to append a period. Given the size of the trait, this pattern might repeat multiple times, it would be better to set this once and refer to it later in the trait as necessary, such as << domain=param.>>

I would like to be able to support something similar to the following:

traits:
 ...
      description:
          This response is returned whenever the << if barId -eq "" >>combination of the passed <<fooId>>  and <<barId>><<else>>the passed <<fooId>><<fi>> is expected.
        body:
          application/problem+json:
            properties:
              <<fooId>>: string
              << if ! barId -eq "" >><<barId>>: string<<fi>>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant