Skip to content

Add missing schema validation fixtures for async, OpenAPI, and workflow steps#476

Open
nashjain wants to merge 5 commits intoOAI:v1.1-devfrom
specmatic:v1.1-dev
Open

Add missing schema validation fixtures for async, OpenAPI, and workflow steps#476
nashjain wants to merge 5 commits intoOAI:v1.1-devfrom
specmatic:v1.1-dev

Conversation

@nashjain
Copy link
Copy Markdown

@nashjain nashjain commented Apr 29, 2026

Summary

Adds fixture coverage for schema validation branches that were already enforced by the Arazzo v1.1 schema but were not explicitly exercised by the test suite.

This PR expands coverage in four areas:

  • Async step validation
  • OpenAPI step validation
  • Workflow step validation
  • Characterization of current schema-permitted behavior

What’s added

Async fixtures

Adds coverage for:

  • operationId and channelPath mutual exclusivity
  • required action on async channelPath steps
  • dependsOn empty array rejection
  • invalid dependsOn reference syntax rejection
  • duplicate dependsOn entry rejection
  • valid receive step without correlationId
  • reusable parameter references on async steps

OpenAPI fixtures

Adds coverage for:

  • valid operationPath-only steps
  • reusable parameter references on OpenAPI steps
  • invalid steps with both operationId and operationPath
  • invalid steps missing both operationId and operationPath
  • duplicate parameter entry rejection

Workflow step fixtures

Adds coverage for:

  • minimal valid workflow steps
  • reusable parameter references on workflow steps
  • invalid workflow steps missing workflowId
  • duplicate workflow-step parameter rejection
  • rejection of async-only fields like action on workflow steps
  • rejection of channelPath on workflow steps

Characterization fixtures

Adds pass fixtures that document current validator behavior where structural schema validation succeeds even though deeper semantic validation would still be required:

  • asyncapi operation step without action
  • OpenAPI operation step with async action
  • OpenAPI receive step with correlationId
  • permissive operationPath string handling
  • permissive channelPath string handling
  • workflow step accepting requestBody

These are intentional characterization tests for current behavior, not normative conformance examples.

Notes

For each new negative fixture, I first verified an otherwise-valid baseline and then introduced the single invalidating change. This was done to ensure failures are attributable to the intended schema branch rather than unrelated document-shape issues.

Validation

  • Ran npm test
  • Result: 62/62 tests passing

Add seven fixture-driven schema tests covering async step validation that was already encoded in the v1.1 schema but not explicitly exercised by the suite.

The new fail fixtures cover mutually exclusive operation targets, missing action on channelPath steps, and dependsOn validation for empty arrays, invalid reference syntax, and duplicate entries. The new pass fixtures cover receive steps without correlationId and reusable parameter references on async steps.

Each negative fixture was authored from an otherwise-valid baseline and checked by applying the minimal invalidating change, so the failures remain attributable to the intended schema branch rather than unrelated missing fields or malformed top-level structure.
Add five fixture-driven schema tests covering OpenAPI step validation paths that were already enforced by the v1.1 schema but were not explicitly exercised by the test suite.

The new pass fixtures cover operationPath-only steps and reusable parameter references for OpenAPI operations. The new fail fixtures cover mutually exclusive operationId/operationPath targets, missing operation targets, and duplicate parameter entries.

Each negative fixture was validated against a repaired baseline first so the final failing YAML is attributable to the intended schema branch rather than unrelated structural mistakes.
Add six fixture-driven schema tests covering workflow-step validation paths that were already enforced by the v1.1 schema but were not explicitly exercised by the suite.

The new pass fixtures cover the minimal valid workflow-step shape and reusable parameter references on workflow steps. The new fail fixtures cover missing workflowId, duplicate workflow-step parameters, and rejection of async-only fields such as action and channelPath on workflow steps.

Each negative fixture was validated against a repaired baseline first so the final failing YAML remains attributable to the intended schema branch rather than unrelated document-shape problems.
Add six pass fixtures that intentionally capture current JSON Schema validator behavior in cases where structural validation succeeds without proving full semantic compliance.

These characterization cases cover source-type mismatches between OpenAPI and AsyncAPI step usage, permissive operationPath and channelPath string handling, and the current acceptance of requestBody on workflow steps because requestBody is defined on step-object-base.

Also add a short informative note to the specification text clarifying that JSON Schema validation alone does not establish full Arazzo conformance and that some constraints require source resolution or other semantic validation across referenced documents.
Drop the recently added note in src/arazzo.md while keeping the characterization fixtures unchanged.
Copy link
Copy Markdown
Collaborator

@frankkilcommins frankkilcommins left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @nashjain. Good to have more tests in this area.

It's good for all to remember the following statement in ~/Arazzo-Specification/src/schemas/validation/README.md:

As a reminder, the JSON Schema is not the source of truth for the Specification.
In cases of conflicts between the Specification itself and the JSON Schema, the
Specification wins. Also, some Specification constraints cannot be represented
with the JSON Schema so it's highly recommended to employ other methods to
ensure compliance.

@frankkilcommins frankkilcommins requested a review from ndenny April 29, 2026 16:09
# Invalid on purpose: dependsOn accepts a plain local stepId (`sendEvent`),
# `$workflows.<workflowId>.steps.<stepId>`, or
# `$sourceDescriptions.<name>.<workflowId>.steps.<stepId>`, but not `$steps.<stepId>`.
- $steps.sendEvent
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.

@frankkilcommins/ @nashjain
I remember there was a discussion about what context $step.STEP_ID refers to.
Would $workflows..steps. be equivalent to $steps. when referencing a step within the current workflow, or is there a difference in scope or resolution?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be the same, and the expectation is that evaluation would work similarly. When within the context of a workflow, $steps. refers to steps within the current workflow only. You could still use $worklows.<workflowId>.steps to get you to the same list assuming the is the current workflow.

workflows:
- workflowId: parentWorkflow
steps:
- stepId: nestedWorkflow
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 check test name, it seems misleading, probably smth about empty step should be mentioned.

workflows:
- workflowId: parentWorkflow
steps:
# Characterization test: this passes today because requestBody is defined
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.

Seems like this test is false positive and don't really check anything except the lack of possible verification. Do we need to have it still?

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