Skip to content

Conversation

@simbo1905
Copy link
Owner

Fixes issue #89 where JTD validator was incorrectly accepting decimal values like 3.14 for int32 type schemas.

Changes Made

  • Bug Fix: Added BigDecimal fractional part checking in validateInteger method in JtdSchema.java
  • Test Coverage: Added testInt32RejectsDecimal test case to verify the fix
  • RFC Compliance: Ensures all integer types reject decimal values as required by RFC 8927

Technical Details

The issue was that the integer validation logic only checked for Double instances with fractional parts, but when creating JsonNumber with BigDecimal(3.14), the fractional check was bypassed. The fix adds proper BigDecimal.scale() greater than 0 checking to ensure all numeric types with fractional parts are rejected.

Testing

  • New test case testInt32RejectsDecimal passes
  • All existing tests continue to pass
  • Property-based testing revealed this issue and is finding additional edge cases for future issues

RFC 8927 Compliance

This fix ensures the JTD validator properly enforces integer type constraints, maintaining full RFC 8927 specification compliance.

Closes #89

- Added BigDecimal fractional part checking in validateInteger method
- Added test case testInt32RejectsDecimal() to verify the fix
- Ensures all integer types (int8, uint8, int16, uint16, int32, uint32) reject decimal values
- Maintains RFC 8927 compliance for integer type validation
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

@openhands-ai
Copy link

openhands-ai bot commented Sep 27, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • CI
    • CI

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #90 at branch `feature/jqwik-property-testing-88`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@simbo1905 simbo1905 merged commit ced2da9 into main Sep 27, 2025
4 checks passed
@simbo1905 simbo1905 deleted the feature/jqwik-property-testing-88 branch September 27, 2025 23:40
@simbo1905 simbo1905 restored the feature/jqwik-property-testing-88 branch September 27, 2025 23:40
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.

JTD int32 type validation should reject decimal values like 3.14

2 participants