Skip to content

Enhance validation coverage for string formats with robust and portable edge cases#880

Closed
OmSwainSupreme wants to merge 2 commits intojson-schema-org:mainfrom
OmSwainSupreme:improve-format-tests
Closed

Enhance validation coverage for string formats with robust and portable edge cases#880
OmSwainSupreme wants to merge 2 commits intojson-schema-org:mainfrom
OmSwainSupreme:improve-format-tests

Conversation

@OmSwainSupreme
Copy link
Copy Markdown

Problem

Several string-based formats lacked comprehensive validation for actual string values and edge cases.
Most existing tests primarily focus on non-string inputs, leaving gaps in real-world validation coverage.

Solution

This PR enhances validation coverage by adding detailed test cases for multiple string formats, including:

  • email
  • regex
  • ipv4
  • hostname
  • date
  • date-time
  • time
  • uri
  • uuid

Improvements

  • Added both valid and invalid edge cases for each format
  • Ensured all test cases are portable and not implementation-dependent
  • Replaced ambiguous patterns (e.g., regex and URI cases) with clearly invalid, standards-compliant examples
  • Maintained consistency with existing test structure and style

Impact

Improves robustness, correctness, and cross-implementation consistency of the JSON Schema test suite.

Notes

Care was taken to avoid implementation-specific behavior and ensure compatibility across different validators.

@OmSwainSupreme OmSwainSupreme requested a review from a team as a code owner March 19, 2026 13:56
@karenetheridge
Copy link
Copy Markdown
Member

The format.json file at the main level of the tests is for the format-annotation library, where all strings should validate, and all non-strings should also validate because they are ignored. There are comprehensive tests for the format-assertion library in the optional/format directories.

Please familiarize yourself with the layout of this test suite and the standards we follow, by consulting its documentation e.g. README.md, before submitting further patches, and propose your changes in an issue first.

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