Skip to content

docs(585): numeric and integer schema fields use exact match by default - #588

Merged
digalaviz merged 1 commit into
awslabs:devfrom
huzaifayasin681:docs/585-numeric-exact-match-default
Nov 18, 2026
Merged

digalaviz merged 1 commit into
awslabs:devfrom
huzaifayasin681:docs/585-numeric-exact-match-default

Conversation

@huzaifayasin681

Copy link
Copy Markdown
Contributor

Closes #585

Description of changes:

number and integer JSON Schema fields map to NumericComparator, whose default tolerance is 0, so they are an exact match by default. Two tables said they tolerate small differences.

Files changed:

  • README.md: the number and integer rows now say "Exact match unless a tolerance is set in x-aws-stickler-comparator-config".

  • docs/docs/Guides/Comparators/README.md: same row fix, plus one example below the table:

    {"type": "number", "x-aws-stickler-comparator-config": {"tolerance": 0.01}}

    A plain {"type": "number"} scores 100 vs 100.01 as 0.0; with tolerance 0.01 it scores 1.0 (verified against this checkout).

tolerance is a backward compatibility alias for absolute_tolerance in NumericComparator, so both keys behave the same.

Checks: docs/check_links.py clean, ruff check . passes, tests/test_readme_examples.py and tests/test_docs_build.py 88 passed.

🤖 Generated with Claude Code

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vawsgit vawsgit left a comment

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.

✅ LGTM!

I checked every claim in the changed text against the code on this head (7962e96a5f4484e3af2805dcd5565f83bd1f43bd), with stickler imported from this checkout's src/.

  • Default comparator and threshold (README.md#L309-L312, Comparators/README.md#L529-L532): a plain number or integer field exports NumericComparator with threshold 0.5. Field names such as total_amount or count do not change this.
  • "Exact match by default": NumericComparator defaults relative_tolerance and absolute_tolerance to 0.0. Measured: number 100 vs 100.01 scores 0.0, and integer 100 vs 101 scores 0.0.
  • New tolerance example (Comparators/README.md#L538-L545): {"tolerance": 0.01} scores 100 vs 100.01 as 1.0, and it exports as absolute_tolerance: 0.01. absolute_tolerance and relative_tolerance give the same result. Setting only x-aws-stickler-comparator-config, with no comparator named, applies to the default NumericComparator.
  • Scope: both tables cover only the JSON Schema path. The inference path (stickler.evaluate, from_pydantic) does give floats a relative tolerance, and the guide already says the two paths do not share defaults. So no other page needs changing. A repo search for "tolerat" and "small numeric" found no other page that claims JSON Schema numbers tolerate differences by default.
  • Issue #585: both locations it names are fixed, and the one-line example it asks for is added with its 0.0 and 1.0 numbers. Closes #585 is correct.
  • PR body checks: docs/check_links.py exits 0, and tests/test_docs_build.py plus tests/test_readme_examples.py give 88 passed.
  • Base: the merge-base equals current dev, so the branch is up to date.

Non-blocking: no test runs the new JSON snippet. I checked it by hand.

@github-actions

Copy link
Copy Markdown

Security Scan Results

ASH Security Scan Report

  • Report generated: 2026-11-18T23:30:27+00:00
  • Time since scan: 3 minutes

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-11-18T23:27:21+00:00
  • ASH version: 3.1.2

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

  • Severity levels:
    • Suppressed (S): Findings that have been explicitly suppressed and don't affect scanner status
    • Critical (C): Highest severity findings that require immediate attention
    • High (H): Serious findings that should be addressed soon
    • Medium (M): Moderate risk findings
    • Low (L): Lower risk findings
    • Info (I): Informational findings with minimal risk
  • Duration (Time): Time taken by the scanner to complete its execution
  • Actionable: Number of findings at or above the threshold severity level that require attention
  • Result:
    • PASSED = No findings at or above threshold
    • FAILED = Findings at or above threshold
    • MISSING = Required dependencies not available
    • SKIPPED = Scanner explicitly disabled
    • ERROR = Scanner execution error
  • Threshold: The minimum severity level that will cause a scanner to fail
    • Thresholds: ALL, LOW, MEDIUM, HIGH, CRITICAL
    • Source: Values in parentheses indicate where the threshold is set:
      • global (global_settings section in the ASH_CONFIG used)
      • config (scanner config section in the ASH_CONFIG used)
      • scanner (default configuration in the plugin, if explicitly set)
  • Statistics calculation:
    • All statistics are calculated from the final aggregated SARIF report
    • Suppressed findings are counted separately and do not contribute to actionable findings
    • Scanner status is determined by comparing actionable findings to the threshold
Scanner Suppressed Critical High Medium Low Info Actionable Result Threshold
bandit 0 0 0 0 6742 0 0 PASSED MEDIUM (global)
cdk-nag 0 0 0 0 0 0 0 PASSED MEDIUM (global)
cfn-nag 0 0 0 0 0 0 0 MISSING MEDIUM (global)
checkov 0 0 0 0 0 0 0 PASSED MEDIUM (global)
detect-secrets 0 0 0 0 0 0 0 PASSED MEDIUM (global)
grype 0 0 0 0 0 0 0 MISSING MEDIUM (global)
npm-audit 0 0 0 0 0 0 0 PASSED MEDIUM (global)
opengrep 0 0 0 0 0 0 0 MISSING MEDIUM (global)
semgrep 3 0 0 0 0 0 0 PASSED MEDIUM (global)
syft 0 0 0 0 0 0 0 MISSING MEDIUM (global)

Report generated by Automated Security Helper (ASH) at 2026-11-18T23:30:28+00:00

@digalaviz
digalaviz merged commit d30ca9d into awslabs:dev Nov 18, 2026
11 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.

Docs: schema number/integer rows say 'tolerates small numeric differences', but the default is an exact match

3 participants