Skip to content

feat: add B015 lint rule for x-sunset-date validation - #1282

Merged
jjjasper merged 1 commit into
mainfrom
feat/x-sunset-date-linting-rule
Sep 3, 2026
Merged

feat: add B015 lint rule for x-sunset-date validation#1282
jjjasper merged 1 commit into
mainfrom
feat/x-sunset-date-linting-rule

Conversation

@jjjasper

@jjjasper jjjasper commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new BOAT lint rule (B015, MUST severity) that validates info.x-deprecated and info.x-sunset-date consistency in OpenAPI specs at provider-side publish time. This resolves follow-up item #1 from the x-sunset-date-linting plan.

Rule behavior

  • x-deprecated: true without x-sunset-date → violation
  • x-deprecated: true with malformed x-sunset-date (not ISO-8601 YYYY-MM-DD) → violation
  • x-sunset-date present but x-deprecated not true → violation (orphaned date)
  • Valid pair or neither set → no violation

Test plan

  • All 9 new test cases pass (valid/invalid date formats, presence/absence combos)
  • No regression: all 71 module tests pass
  • Rule auto-discovered via classpath scan (no registry changes needed)

🤖 Generated with Claude Code

Ensure specs don't set info.x-deprecated: true without a valid info.x-sunset-date.
Resolves the follow-up item from x-sunset-date-linting.md: a BOAT linting rule
(provider-side, at publish time) that fails when x-deprecated is true but x-sunset-date
is missing, empty, or malformed (not YYYY-MM-DD). Also flags the inverse case: x-sunset-date
present but x-deprecated not set, indicating a stale orphaned date.

Closes the loop so future deprecations default to providing an explicit sunset date
rather than silently omitting it and relying on a 7-month heuristic.

Rule B015 is MUST severity (build-breaking under failOnWarning), matching the
precedent of EndpointAccessControlDefinedRule (B013).

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

@Rule(
ruleSet = BoatRuleSet::class,
id = "B015",
severity = Severity.MUST,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if this will break builds for the services which already have a deprecated specs, do we need to add an explanation in README.md?

@jjjasper
jjjasper merged commit bea86f4 into main Sep 3, 2026
4 checks passed
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