Skip to content

lint: add incoherent_exclusive_limits rule#818

Open
AcEKaycgR wants to merge 1 commit into
sourcemeta:mainfrom
AcEKaycgR:feat/linter-incoherent_exclusive_limits
Open

lint: add incoherent_exclusive_limits rule#818
AcEKaycgR wants to merge 1 commit into
sourcemeta:mainfrom
AcEKaycgR:feat/linter-incoherent_exclusive_limits

Conversation

@AcEKaycgR
Copy link
Copy Markdown
Contributor

@AcEKaycgR AcEKaycgR commented May 19, 2026

Summary

Adds a new lint rule incoherent_exclusive_limits that fires when exclusiveMinimum is greater than or equal to exclusiveMaximum, making the schema unsatisfiable.

Applies to Draft 6, Draft 7, 2019-09, and 2020-12.

Test cases (per dialect)

  • Valid: exclusiveMinimum < exclusiveMaximum
  • Valid: only exclusiveMinimum present
  • Valid: only exclusiveMaximum present
  • Invalid: exclusiveMinimum == exclusiveMaximum
  • Invalid: exclusiveMinimum > exclusiveMaximum

Changes

  • src/alterschema/linter/incoherent_exclusive_limits.h - new rule
  • src/alterschema/alterschema.cc - rule registered for all four dialects
  • src/alterschema/CMakeLists.txt - header added
  • test/alterschema/alterschema_lint_draft6_test.cc - tests added
  • test/alterschema/alterschema_lint_draft7_test.cc - tests added
  • test/alterschema/alterschema_lint_2019_09_test.cc - tests added
  • test/alterschema/alterschema_lint_2020_12_test.cc - tests added

Part of sourcemeta/core#1975.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 19, 2026

🤖 Augment PR Summary

Summary: This PR introduces a new linter rule, incoherent_exclusive_limits, to detect contradictory numeric-exclusive bounds in JSON Schemas.

Changes:

  • Added IncoherentExclusiveLimits rule that triggers when exclusiveMinimum is greater than or equal to exclusiveMaximum
  • Registered the rule in the AlterSchema linter bundle so it runs during lint mode
  • Updated AlterSchema CMake source list to include the new header
  • Added test coverage for Draft 7, 2019-09, and 2020-12 covering coherent, missing-bound, and incoherent-bound cases

Technical Notes: The rule is non-mutating (lint-only) and reports both keywords as implicated when it fires.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/alterschema/linter/incoherent_exclusive_limits.h
Comment thread src/alterschema/linter/incoherent_exclusive_limits.h
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread test/alterschema/alterschema_lint_2019_09_test.cc
Comment thread test/alterschema/alterschema_lint_draft7_test.cc
Signed-off-by: AcE <kintan0108@gmail.com>
@AcEKaycgR AcEKaycgR force-pushed the feat/linter-incoherent_exclusive_limits branch from efb534c to bffc321 Compare May 19, 2026 04:19
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.

1 participant