Skip to content

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

Open
harshit078 wants to merge 14 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 14 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
Adds a new built-in Arazzo lint rule and enables it in stricter/default rulesets, which can introduce new lint errors for existing Arazzo files. Also expands the Arazzo schema/types to accept parameters on success/failure actions, affecting validation and downstream consumers.

Overview
Adds the new Arazzo rule spec-parameters-in-by-context to enforce context-dependent validation of parameter in: required for workflow/operation-backed parameters and forbidden when a step/action references a workflowId (parameters map to workflow inputs), and it errors if success/failure actions define parameters without a workflowId.

Updates built-in rule registrations and default rulesets (including spec, recommended, recommended-strict, all) so the rule is active by default at warn/error, and extends Arazzo success/failure action schemas/types (core + respect) to support an action-level parameters field; includes new docs and a comprehensive test suite for the rule.

Reviewed by Cursor Bugbot for commit ffd8f5a. 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: ffd8f5a

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
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 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 6b7e963. Configure here.

Comment thread packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts Outdated
import type { Arazzo1Rule } from '../../visitors.js';
import type { UserContext } from '../../walk.js';

const IN_REQUIRED_MESSAGE =
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.

You can use report messages directly

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.

yep I agree ! Made changes.

@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
"@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 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

Choose a reason for hiding this comment

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

I think, we need to add Note, that lint can produce errors after this rule release as we add this rule to the recommended ruleset with error setting.

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.

agree, I have added a note !

}

function checkParameters(
parameters: any,
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, avoid using any, because we provide proper types

```yaml
rules:
spec-parameters-in-by-context: error
```## Examples
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 line break


## Resources

- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts) No newline at end of file
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.

Let's add a new line at the end, the issue with code-quality should disappear.

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.

2 participants