Skip to content

Conversation

@Kartikayy007
Copy link

Description

  • Adds a --ruleset flag to the validate command to support custom Spectral rulesets.
  • Supports JS (.js, .mjs, .cjs) and YAML/JSON rulesets (.yaml, .yml, .json).
  • Keeps the existing default AsyncAPI/Spectral validation behavior unchanged when --ruleset is not provided.
  • Allows teams to enforce organization‑specific validation rules on AsyncAPI documents.

Note: YAML rulesets that rely on custom Spectral functions may have compatibility issues with @asyncapi/parser’s ruleset validation. For full support of custom functions, prefer JS rulesets (.spectral.js).

Related issue(s)

Resolves #1900
Part of #1785

Test plan

  • Unit tests for custom ruleset validation (test/unit/services/validation.service.test.ts)
  • Integration tests for validate command (test/integration/validate.test.ts)
  • asyncapi validate --help shows the new --ruleset flag

screenshot

Screenshot 2025-11-20 at 3 58 39 AM

@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2025

🦋 Changeset detected

Latest commit: bbc661f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

Changeset has been generated for this PR as part of auto-changeset workflow.

Please review the changeset before merging the PR.
---
'@asyncapi/cli': minor
---

feat: add --ruleset flag for custom Spectral rules

- 5872e92: feat: add --ruleset flag for custom Spectral rules
- 97ec751: fixed the sonar issue

If you are a maintainer or the author of the PR, you can change the changeset by clicking here

Tip

If you don't want auto-changeset to run on this PR, you can add the label skip-changeset to the PR or remove the changeset and change PR title to something other than fix: or feat:.

@sonarqubecloud
Copy link

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