Skip to content

Conversation

@simbo1905
Copy link
Owner

This PR fixes issue #91 where the JTD validator incorrectly defaulted additionalProperties to true when no properties were defined.

Changes

  • Fixed JTD validator to correctly default additionalProperties to false when no properties are defined (Jtd.java:446)
  • Added test case testAdditionalPropertiesDefaultsToFalse() to verify the fix
  • Updated CI test count from 463 to 464 to account for new test

The Bug

The JTD validator had incorrect logic where an empty properties schema like would incorrectly allow additional properties instead of rejecting them by default.

The Fix

Changed line 446 in Jtd.java from to to ensure RFC 8927 compliance.

Testing

  • New test case added to TestRfc8927 that verifies empty properties schemas reject additional properties
  • All existing tests continue to pass
  • This ensures proper RFC 8927 compliance

Closes #91

- 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
- Fixed JTD validator to correctly default additionalProperties to false when no properties are defined
- Added test case testAdditionalPropertiesDefaultsToFalse() to verify the fix
- Updated CI test count from 463 to 464 to account for new test
- This ensures RFC 8927 compliance where empty properties schemas reject additional properties by default

The bug was in Jtd.java line 446 where additionalProperties was set to true instead of false
when both properties and optionalProperties were empty. This caused empty schemas to incorrectly
allow additional properties instead of rejecting them by default.

Closes #91
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

- Removed JtdExhaustiveTest.java from this PR to separate property test development from the bug fix
- Backed up the property test as JtdExhaustiveTest.java.backup for future development
- Updated CI test count from 464 back to 463 to reflect removal of property test
- This allows the additionalProperties bug fix (Issue #91) to be merged independently
- The property test can be restored and continued separately after merge
@openhands-ai
Copy link

openhands-ai bot commented Sep 28, 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 #92 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 2c93ff8 into main Sep 28, 2025
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.

JTD validator incorrectly defaults additionalProperties to true when no properties are defined

2 participants