Skip to content

feat: add --ruleset flag for custom Spectral rules#2119

Open
armorbreak001 wants to merge 1 commit intoasyncapi:masterfrom
armorbreak001:bounty/1900-ruleset-flag
Open

feat: add --ruleset flag for custom Spectral rules#2119
armorbreak001 wants to merge 1 commit intoasyncapi:masterfrom
armorbreak001:bounty/1900-ruleset-flag

Conversation

@armorbreak001
Copy link
Copy Markdown

Fixes #1900

Changes

  • Added --ruleset / -r flag to the validate command in src/apps/cli/internal/flags/validate.flags.ts
  • Added ruleset? to ValidationOptions interface in src/interfaces/index.ts
  • Updated ValidationService.validateDocument() to use a custom ruleset parser when --ruleset is provided
  • Added buildParserWithCustomRuleset() method that creates a Parser with the specified ruleset file path

Usage

asyncapi validate spec.yaml --ruleset ./my-custom-rules.yaml
asyncapi validate spec.yaml -r .spectral.json

Verification

  1. Create a custom Spectral ruleset file (e.g., .spectral.yaml)
  2. Run: asyncapi validate <spec-file> --ruleset <ruleset-file>
  3. Verify validation uses the custom ruleset instead of defaults

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 13, 2026

⚠️ No Changeset found

Latest commit: 350e58f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

feat: add --ruleset flag for custom Spectral rules

1 participant