Skip to content

fix: pass workflow inputs to success and failure actions#2796

Open
harshit078 wants to merge 34 commits into
Redocly:mainfrom
harshit078:pass-workflow-input-to-actions
Open

fix: pass workflow inputs to success and failure actions#2796
harshit078 wants to merge 34 commits into
Redocly:mainfrom
harshit078:pass-workflow-input-to-actions

Conversation

@harshit078

@harshit078 harshit078 commented May 4, 2026

Copy link
Copy Markdown
Contributor

What/Why/How?

  • Added the spec-parameters-in-by-context Arazzo rule
  • Added parameters property in interface of workflow for success and failure action objects.

Reference

#2735

Testing

Screenshots (optional)

Check yourself

  • This PR follows the contributing guide
  • All new/updated code is covered by tests
  • Core code changed? - Tested with other Redocly products (internal contributions only)
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update has been considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

Note

Medium Risk
Respect workflow branching now merges action parameters into target workflow inputs, which can change runtime behavior for existing Arazzo files; the new lint rule may surface warnings/errors on previously accepted documents.

Overview
Adds Arazzo support for parameters on success and failure actions (name/value only, mapped to a referenced workflow’s inputs) and wires Respect so those values are merged into the target workflow’s $inputs when a goto action runs with a workflowId.

Introduces the spec-parameters-in-by-context lint rule: inline parameters must include in on workflows and on steps that target operations (not workflowId); action parameters are only allowed when the action has a workflowId. Schema/types gain ActionParameter / ActionParameters; parameters-unique also applies to action parameter lists. Documentation, default rulesets, and tests cover the new rule and runtime behavior.

Reviewed by Cursor Bugbot for commit ae9e4c7. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented May 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae9e4c7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/openapi-core Minor
@redocly/cli Minor
@redocly/respect-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@harshit078 harshit078 marked this pull request as ready for review May 8, 2026 10:20
@harshit078 harshit078 requested review from a team as code owners May 8, 2026 10:20
Comment thread packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts Outdated
Comment thread packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts Outdated
@AlbinaBlazhko17

Copy link
Copy Markdown
Contributor

Thanks @harshit078 for contribution! Please, fix the issue reported by bugbot. I left comment as well. Additionally, please add docs for a new rule.

@harshit078

Copy link
Copy Markdown
Contributor Author

Hey @AlbinaBlazhko17 , I have pushed a fix addressing both cursor and your comment along with addition of docs for spec-parameters-in-by-context hence made changes in v2 docs.


export const SpecParametersInByContext: Arazzo1Rule = () => {
return {
Step: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add to this rule Workflowvisitor, because you miss, that Workflow also accepts parameters per arazzo.ts:179.

Comment thread .changeset/swift-otters-wander.md Outdated
Comment thread packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts Outdated
Comment thread docs/@v2/rules/arazzo/spec-parameters-in-by-context.md Outdated
Comment thread docs/@v2/rules/arazzo/spec-parameters-in-by-context.md Outdated
Comment thread packages/core/src/types/arazzo.ts Outdated
@harshit078

Copy link
Copy Markdown
Contributor Author

Hey @AlbinaBlazhko17 , I have addressed the comments you left and created a seperate parameter interface and used that. I am not sure on how to resolve the 2 failing test though. Thanks !

type: 'array',
items: parameter,
} as const;
export const actionParameter = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add please spacing between Parameters, actionParameter and actionParameters.

Comment thread packages/core/src/rules/arazzo/parameters-unique.ts Outdated
@AlbinaBlazhko17

Copy link
Copy Markdown
Contributor

Hi @harshit078! Almost done, left minor comments, otherwise looks good.
Let me help you with the issues in CI:

  • To fix error in build and unit run npm run unit -- -u. This command will regenerate the snapshot, because you've added new types.
  • To fix error in code-style-check run npm run format. We use as a formatter Oxfmt, so please, make sure, that you installed in your IDE Oxc extension and use this formatter for our CLI repository.

@harshit078

Copy link
Copy Markdown
Contributor Author

Hi @AlbinaBlazhko17 , I have tried doing both the commands and pushed the commit for it but the tests still fails. Is there something I might be doing wrong ?

@AlbinaBlazhko17

AlbinaBlazhko17 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Hi @harshit078! You fixed first batch of errors. Let's fix the second:

  1. To fix build-and-unit run command npm run e2e -- -u to update two snapshots.
  2. The code-style-check failed due to an error (listed below), you need to use isPlainObject.
  × oxlint-redocly-plugin(no-typeof-object): Avoid `typeof ... 'object'` comparison. Use `isPlainObject` helper instead.
   ╭─[packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts:6:32]
 5 │ function isInlineParameter(parameter: Parameter): boolean {
 6 │   return Boolean(parameter) && typeof parameter === 'object' && !('reference' in parameter);
   ·                                ─────────────────────────────
 7 │ }
   ╰────

@harshit078

Copy link
Copy Markdown
Contributor Author

Hey @AlbinaBlazhko17 , thank you for helping me out. The PR is good to go on the check side.

Comment thread .changeset/swift-otters-wander.md Outdated

## Design principles

The Arazzo specification states that when a step, success action, or failure action specifies a `workflowId`, all parameters map to the referenced workflow's inputs and the `in` field MUST NOT be specified.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harshit078
Please correct me if I’m wrong, but this statement seems to be inaccurate.
The Arazzo specification only mentions this for Success Action Object and Failure Action Object but not for the step.

A list of parameters that MUST be passed to a workflow as referenced by workflowId. If a Reusable Object is provided, it MUST link to a parameter defined in the [components/parameters](https://spec.openapis.org/arazzo/latest.html#components-object) of the current Arazzo document. The list MUST NOT include duplicate parameters. The `in` field MUST NOT be used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryAnansky DmitryAnansky Jun 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d also like to clarify whether step-level parameters that don’t include an in field should be merged into the success and failure action objects.
Here is my question for the community => https://open-api.slack.com/archives/C022K8VD7AP/p1780496931264819

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got confused on my end a bit but I agree, I assumed that step was included along with success and failure. I read the docs but couldnt open the slack archive as account was not there in that community and I have made changes to only keep to success and failure and revamped my verbiage in arrazo rules and also spec-parmaters context.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my question to the community, in case you were not able to join =>

Hi All,
I have a question regarding the recent parameter updates in Arazzo 1.1.
Could you please clarify this behavior for me?
Should step level parameters without in be merged into Success/Failure Action Objects?


workflows:
  - workflowId: someWorkflow
    steps:
      - stepId: someStep
        operationId: create
        parameters:
          - name: sort
            in: query
            value: '-name'
          - name: endDate
            value: '2026-08-08'
        onSuccess:
          - name: successFlow
            workflowId: successActionWorkflowId
            type: goto
            parameters:
              - name: startDate
                value: '2026-01-01'

Will the successActionWorkflowId workflow have two input parameters (startDate and endDate), or only one (startDate) ?
Thank you.

I will add more details here after the reply.

Comment thread docs/@v2/rules/arazzo/spec-parameters-in-by-context.md Outdated
operationId: createTicket
onSuccess:
- name: end-with-params
type: end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like parameters also won't make sense when action type is end.
What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I agree, I'll remove it. it is redundant to have it.

Comment thread packages/respect-core/src/arazzo-schema.ts Outdated
Comment thread packages/respect-core/src/modules/flow-runner/run-step.ts
Comment thread packages/respect-core/src/modules/flow-runner/run-step.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e1820da. Configure here.

Comment thread packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts
@harshit078 harshit078 requested a review from DmitryAnansky June 4, 2026 11:37
...basicCTX,
$workflows: {
'get-bird-workflow': { steps: {}, inputs: {} },
'success-action-workflow': { steps: {}, inputs: {} },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will clarify this with the Arazzo community, but in my opinion, only inputs defined by the workflow JSON Schema should be passed to the workflow.
In practice, this would mean that when parameters without in are passed to a workflow, only those defined in workflow.inputs JSON schema would be available in the workflow runtime context through $inputs.

Currently all of inputs are passed, and this was the behavior before changes in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, lets wait till then !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DmitryAnansky , any update ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harshit078,
No response yet, still waiting.

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 this pull request may close these issues.

3 participants