Skip to content

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

Open
harshit078 wants to merge 28 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 28 commits into
Redocly:mainfrom
harshit078:pass-workflow-input-to-actions

Conversation

@harshit078
Copy link
Copy Markdown
Contributor

@harshit078 harshit078 commented May 4, 2026

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
Stricter default/spec rulesets can newly fail Arazzo lint on existing descriptions, and Respect workflow goto behavior changes when actions pass parameters.

Overview
Adds Arazzo spec-parameters-in-by-context so parameter in is required for workflow/step operation parameters and forbidden when the parent uses workflowId; success/failure actions may only define parameters when they reference a workflowId. The model gains ActionParameter / ActionParameters on onSuccess / onFailure, parameters-unique covers those lists, and Respect run-step merges action parameters into the target workflow’s inputs (same helper as step → child workflow). Docs, changeset, and preset wiring (error in spec / all / recommended-strict, warn in recommended) mean stricter Arazzo lint may surface new issues on existing files.

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: a58b507

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/respect-core Minor
@redocly/cli 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
Comment thread packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts
Comment thread packages/core/src/rules/arazzo/__tests__/spec-parameters-in-by-context.test.ts Outdated
Comment thread packages/core/src/types/arazzo.ts Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 2 potential issues.

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 8b47027. Configure here.

Comment thread packages/core/src/types/arazzo.ts
Comment thread packages/core/src/types/arazzo.ts
@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
Copy link
Copy Markdown
Contributor

AlbinaBlazhko17 commented Jun 2, 2026

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.

'@redocly/cli': minor
---

Added the `spec-parameters-in-by-context` Arazzo rule, which validates that a parameter's `in` field is specified when the parent workflow, step, success action, or failure action does not reference a `workflowId`. Extended success and failure action objects to accept a `parameters` property that maps to workflow inputs.
Copy link
Copy Markdown
Contributor

@DmitryAnansky DmitryAnansky Jun 3, 2026

Choose a reason for hiding this comment

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

Please make two separate changelog files:

  • one with the: "Extended success and failure action objects to accept a parameters property that maps to workflow inputs."
  • other with the rule updates: "Added the spec-parameters-in-by-context Arazzo rule, which validates that a parameter's in field is specified when the parent workflow, step, success action, or failure action does not reference a workflowId. "


## 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.

Copy link
Copy Markdown
Contributor

@DmitryAnansky DmitryAnansky Jun 3, 2026

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

## 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.
In every other case (for example, when a step specifies an `operationId`, `operationPath`, or `x-operation`, or for parameters defined at the workflow level), the `in` field MUST be specified on each parameter.
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.

The location of the parameter. Possible values are "path", "query", "querystring", "header", or "cookie". When the step, success action, or failure action in context specifies a workflowId, then all parameters map to workflow inputs. In all other scenarios (e.g., a step specifies an operationId), the in field MUST be specified.

As in is not REQUERED, it seems to be more like => when in is not specified - then those parameters will be mapped to the workflow input when workflowId used.

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?

value: {
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
},
'x-allowReserved': { type: 'boolean' },
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.

Why do we need x-allowReserved here?

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