Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5649bbd
feat: add parameters field to Success and Failure in arrazo
harshit078 May 4, 2026
7646ee8
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 7, 2026
c46b071
feat: added spec parameters for arrazo rules in config
harshit078 May 7, 2026
613e9a3
feat: added specs parameters logic and test with changeset
harshit078 May 8, 2026
6b7e963
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 8, 2026
a41e2aa
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 18, 2026
e057bd1
fix: address comments and added docs
harshit078 May 18, 2026
f218352
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 18, 2026
28c0ac1
fix: failing markdownlint failing test
harshit078 May 18, 2026
c3223dc
fix: markdownlint failing test
harshit078 May 18, 2026
f3ffcdd
fix: address comments and updated changset and used paramters interface
harshit078 May 20, 2026
db9eb6b
fix: added spec parameter test
harshit078 May 20, 2026
83a27cb
fix: minor lint fix
harshit078 May 20, 2026
ffd8f5a
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 20, 2026
a0470a4
fix: address comment and fix verbiage
harshit078 May 28, 2026
ba3b600
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 28, 2026
667cf82
feat: added actionParameters in replacement of parameters
harshit078 May 28, 2026
af9e4be
feat: added actionParameters for workflow actions
harshit078 May 28, 2026
8b47027
fix: updated tests
harshit078 May 28, 2026
d0fc683
feat: added mapParametersToWorkflowInputs function in run step for be…
harshit078 May 28, 2026
50a990e
feat: added mapParametersToWorkflowInput tests
harshit078 May 28, 2026
f7deff3
fix: address cursor comments
harshit078 May 28, 2026
03b6896
fix: address comments and fix linting errors
harshit078 May 29, 2026
c095135
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 May 29, 2026
1ff644f
fix: linting errors
harshit078 May 29, 2026
b12d4c7
fix: failing build test
harshit078 May 29, 2026
a58b507
fix: failing lint test
harshit078 Jun 2, 2026
41b8546
fix: failing lint test
harshit078 Jun 2, 2026
ce4f733
fix: remove x-allowedReserved from actionParameter
harshit078 Jun 4, 2026
a14a54b
fix: updated changesets
harshit078 Jun 4, 2026
a1443a6
fix: updated validation for in field in parameters
harshit078 Jun 4, 2026
e1820da
Merge branch 'main' into pass-workflow-input-to-actions
harshit078 Jun 4, 2026
64f339e
fix: updated tests for in field now
harshit078 Jun 4, 2026
ae9e4c7
fix: failing e2e tests and added snapshots
harshit078 Jun 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/swift-otters-wander.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@redocly/openapi-core': minor
'@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`.
7 changes: 7 additions & 0 deletions .changeset/thin-aliens-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@redocly/openapi-core': minor
'@redocly/respect-core': minor
'@redocly/cli': minor
---

Extended success and failure action objects to accept a `parameters` property that maps to workflow inputs.
122 changes: 122 additions & 0 deletions docs/@v2/rules/arazzo/spec-parameters-in-by-context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# spec-parameters-in-by-context

Validates how the `in` field is used on parameters based on the parent context.

| Arazzo | Compatibility |
| ------ | ------------- |
| 1.x | ✅ |

## Design principles

The `in` field on an Arazzo parameter is not a required property — omitting it carries semantics.
When a step references a `workflowId`, a parameter with no `in` field is mapped to the referenced workflow's inputs.
When `in` is specified, the parameter is sent at that request location (`header`, `query`, `path`, or `cookie`) against the targeted operation.

This rule enforces the following:

- For a step that does not reference a `workflowId` (for example, one using `operationId`, `operationPath`, or `x-operation`), and for parameters defined at the workflow level, `in` must be specified on each inline parameter.
- Parameters on success and failure actions are only valid when the action references a `workflowId` — these parameters map to the referenced workflow's inputs and the spec states that `in` MUST NOT be used on them (see the [Success Action Object](https://spec.openapis.org/arazzo/latest.html#success-action-object) and [Failure Action Object](https://spec.openapis.org/arazzo/latest.html#failure-action-object)).

## Configuration

| Option | Type | Description |
| -------- | ------ | ------------------------------------------------------- |
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. |

An example configuration:

```yaml
rules:
spec-parameters-in-by-context: error
```

## Examples

Given the following configuration:

```yaml
rules:
spec-parameters-in-by-context: error
```

Example of a **correct** step referencing an `operationId` (each parameter declares `in`):

```yaml
# Correct example - operationId
workflows:
- workflowId: get-museum-hours
steps:
- stepId: list-hours
operationId: listMuseumHours
parameters:
- in: query
name: startDate
value: '2024-01-01'
```

Example of a **correct** step referencing a `workflowId` (parameters omit `in` and are mapped to the referenced workflow's inputs):

```yaml
# Correct example - workflowId
workflows:
- workflowId: buy-tickets
steps:
- stepId: reuse-hours-workflow
workflowId: get-museum-hours
parameters:
- name: startDate
value: '2024-01-01'
```

Example of a **correct** success action transferring to another workflow with mapped parameters:

```yaml
# Correct example - success action
workflows:
- workflowId: buy-tickets
steps:
- stepId: purchase
operationId: createTicket
onSuccess:
- name: continue-to-hours
type: goto
workflowId: get-museum-hours
parameters:
- name: startDate
value: '2024-01-01'
```

Example of an **incorrect** step referencing an `operationId` while omitting `in`:

```yaml
# Incorrect example - operationId without `in`
workflows:
- workflowId: get-museum-hours
steps:
- stepId: list-hours
operationId: listMuseumHours
parameters:
- name: startDate
value: '2024-01-01'
```

Example of an **incorrect** success action defining `parameters` without referencing a `workflowId`:

```yaml
# Incorrect example - action without workflowId
workflows:
- workflowId: buy-tickets
steps:
- stepId: purchase
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.

parameters:
- name: startDate
value: '2024-01-01'
```

## Resources

- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/spec-parameters-in-by-context.ts)
1 change: 1 addition & 0 deletions docs/@v2/rules/built-in-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Within the Arazzo family of rules, there are rules for the main Arazzo specifica
- [requestBody-replacements-unique](./arazzo/requestBody-replacements-unique.md): the `replacements` of the `requestBody` object must be unique
- [sourceDescription-name-unique](./arazzo/sourceDescription-name-unique.md): the `name` property of the `sourceDescription` object must be unique across all source descriptions
- [sourceDescription-type](./arazzo/sourceDescription-type.md): the `type` property of the `sourceDescription` object must be either `openapi` or `arazzo`
- [spec-parameters-in-by-context](./arazzo/spec-parameters-in-by-context.md): the parameter `in` field must be specified or omitted based on whether the parent step or action references a `workflowId`
- [stepId-unique](./arazzo/stepId-unique.md): the `stepId` must be unique amongst all steps described in the workflow
- [step-onFailure-unique](./arazzo/step-onFailure-unique.md): the `onFailure` actions of the `step` object must be unique
- [step-onSuccess-unique](./arazzo/step-onSuccess-unique.md): the `onSuccess` actions of the `step` object must be unique
Expand Down
1 change: 1 addition & 0 deletions docs/@v2/v2.sidebars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
- page: rules/arazzo/requestBody-replacements-unique.md
- page: rules/arazzo/sourceDescription-name-unique.md
- page: rules/arazzo/sourceDescription-type.md
- page: rules/arazzo/spec-parameters-in-by-context.md
- page: rules/arazzo/stepId-unique.md
- page: rules/arazzo/step-onFailure-unique.md
- page: rules/arazzo/step-onSuccess-unique.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,8 @@ exports[`createConfigTypes > matches snapshot for the default config schema 1`]
"OpenAPISourceDescription",
"ArazzoSourceDescription",
"Parameters",
"ActionParameters",
"ActionParameter",
"ReusableObject",
"Workflows",
"Workflow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`resolveConfig > should ignore minimal from the root and read local file
"sourceDescription-name-unique": "error",
"sourceDescription-type": "error",
"sourceDescriptions-not-empty": "error",
"spec-parameters-in-by-context": "warn",
"step-onFailure-unique": "warn",
"step-onSuccess-unique": "warn",
"stepId-unique": "error",
Expand Down Expand Up @@ -407,6 +408,7 @@ exports[`resolveConfig > should resolve extends with local file config which con
"sourceDescription-name-unique": "error",
"sourceDescription-type": "error",
"sourceDescriptions-not-empty": "error",
"spec-parameters-in-by-context": "warn",
"step-onFailure-unique": "warn",
"step-onSuccess-unique": "warn",
"stepId-unique": "error",
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/config/__tests__/load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ describe('loadConfig', () => {
"sourceDescription-name-unique": "off",
"sourceDescription-type": "off",
"sourceDescriptions-not-empty": "off",
"spec-parameters-in-by-context": "off",
"step-onFailure-unique": "off",
"step-onSuccess-unique": "off",
"stepId-unique": "error",
Expand Down Expand Up @@ -467,6 +468,7 @@ describe('loadConfig', () => {
"sourceDescription-name-unique": "error",
"sourceDescription-type": "error",
"sourceDescriptions-not-empty": "error",
"spec-parameters-in-by-context": "warn",
"step-onFailure-unique": "warn",
"step-onSuccess-unique": "warn",
"stepId-unique": "error",
Expand Down Expand Up @@ -796,6 +798,7 @@ describe('loadConfig', () => {
"sourceDescription-name-unique": "off",
"sourceDescription-type": "off",
"sourceDescriptions-not-empty": "off",
"spec-parameters-in-by-context": "off",
"step-onFailure-unique": "off",
"step-onSuccess-unique": "off",
"stepId-unique": "error",
Expand Down Expand Up @@ -1209,6 +1212,7 @@ describe('loadConfig', () => {
"sourceDescription-name-unique": "off",
"sourceDescription-type": "off",
"sourceDescriptions-not-empty": "off",
"spec-parameters-in-by-context": "off",
"step-onFailure-unique": "off",
"step-onSuccess-unique": "off",
"stepId-unique": "error",
Expand Down Expand Up @@ -1533,6 +1537,7 @@ describe('loadConfig', () => {
"sourceDescription-name-unique": "error",
"sourceDescription-type": "error",
"sourceDescriptions-not-empty": "error",
"spec-parameters-in-by-context": "warn",
"step-onFailure-unique": "warn",
"step-onSuccess-unique": "warn",
"stepId-unique": "error",
Expand Down Expand Up @@ -1862,6 +1867,7 @@ describe('loadConfig', () => {
"sourceDescription-name-unique": "off",
"sourceDescription-type": "off",
"sourceDescriptions-not-empty": "off",
"spec-parameters-in-by-context": "off",
"step-onFailure-unique": "off",
"step-onSuccess-unique": "off",
"stepId-unique": "error",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ const all: RawGovernanceConfig<'built-in'> = {
'sourceDescription-name-unique': 'error',
'sourceDescription-type': 'error',
'sourceDescriptions-not-empty': 'error',
'spec-parameters-in-by-context': 'error',
'step-onFailure-unique': 'error',
'step-onSuccess-unique': 'error',
'stepId-unique': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const minimal: RawGovernanceConfig<'built-in'> = {
'sourceDescription-name-unique': 'off',
'sourceDescription-type': 'off',
'sourceDescriptions-not-empty': 'off',
'spec-parameters-in-by-context': 'off',
'step-onFailure-unique': 'off',
'step-onSuccess-unique': 'off',
'stepId-unique': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/recommended-strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const recommendedStrict: RawGovernanceConfig<'built-in'> = {
'sourceDescription-name-unique': 'error',
'sourceDescription-type': 'error',
'sourceDescriptions-not-empty': 'error',
'spec-parameters-in-by-context': 'error',
'step-onFailure-unique': 'error',
'step-onSuccess-unique': 'error',
'stepId-unique': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const recommended: RawGovernanceConfig<'built-in'> = {
'sourceDescription-name-unique': 'error',
'sourceDescription-type': 'error',
'sourceDescriptions-not-empty': 'error',
'spec-parameters-in-by-context': 'warn',
'step-onFailure-unique': 'warn',
'step-onSuccess-unique': 'warn',
'stepId-unique': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/config/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const spec: RawGovernanceConfig<'built-in'> = {
'sourceDescription-name-unique': 'error',
'sourceDescription-type': 'error',
'sourceDescriptions-not-empty': 'error',
'spec-parameters-in-by-context': 'error',
'step-onFailure-unique': 'error',
'step-onSuccess-unique': 'error',
'stepId-unique': 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,87 @@ describe('Arazzo parameters-unique', () => {
]
`);
});

it('should report on duplicated `parameters` defined on success/failure actions', async () => {
const actionDocument = parseYamlToDocument(
outdent`
arazzo: '1.0.1'
info:
title: Cool API
version: 1.0.0
description: A cool API
sourceDescriptions:
- name: museum-api
type: openapi
url: openapi.yaml
workflows:
- workflowId: outer
steps:
- stepId: step-1
operationId: museum-api.getMuseumHours
onSuccess:
- name: go-next
type: goto
workflowId: inner
parameters:
- name: token
value: a
- name: token
value: b
onFailure:
- name: recover
type: goto
workflowId: inner
parameters:
- name: retryToken
value: a
- name: retryToken
value: b
- workflowId: inner
steps:
- stepId: noop
operationId: museum-api.getMuseumHours
`,
'arazzo.yaml'
);

const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document: actionDocument,
config: await createConfig({
rules: { 'parameters-unique': 'error' },
}),
});

expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/workflows/0/steps/0/onSuccess/0/parameters/1",
"reportOnKey": false,
"source": "arazzo.yaml",
},
],
"message": "The parameter \`name\` must be unique amongst listed parameters.",
"ruleId": "parameters-unique",
"severity": "error",
"suggest": [],
},
{
"location": [
{
"pointer": "#/workflows/0/steps/0/onFailure/0/parameters/1",
"reportOnKey": false,
"source": "arazzo.yaml",
},
],
"message": "The parameter \`name\` must be unique amongst listed parameters.",
"ruleId": "parameters-unique",
"severity": "error",
"suggest": [],
},
]
`);
});
});
Loading
Loading