jsonrainbow/json-schema
58.2
Adequate · 17 November 2026
9.9k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
Add JSON Schema Draft-07 validation support
This change introduces full validation support for the JSON Schema Draft-07 specification. It adds a new constraint hierarchy under src/JsonSchema/Constraints/Drafts/Draft07, including a central Draft07Constraint orchestrator and specific validators for all Draft-07 keywords such as const, contains, content, if/then/else, propertyNames, and exclusiveMinimum/exclusiveMaximum. The implementation also includes updated format validation in FormatConstraint to support Draft-07 formats like iri, iri-reference, uri-template, and idn-email, ensuring that JSON documents validated against Draft-07 schemas are checked according to the latest standard.
src/JsonSchema/Constraints/Drafts/Draft06, src/JsonSchema/Constraints/Drafts/Draft07, src/JsonSchema/Constraints/Drafts/Draft2019 · high confidence
Add JsonSchema Validator demo script and sample files
A new demo directory has been added to help users quickly test the JsonSchema Validator. This includes a PHP script (demo.php) that validates a sample JSON file (data.json) against a basic schema (schema.json), along with a README explaining how to run the script and modify the input files.
demo · high confidence
Introduce pluggable type-checking strategies for objects and arrays
The library now supports configurable type-checking behavior through a new \TypeCheckInterface\ and two implementations: \StrictTypeCheck\ and \LooseTypeCheck\. \StrictTypeCheck\ enforces native PHP type distinctions (e.g., arrays are never considered objects), while \LooseTypeCheck\ treats associative arrays as objects to align with JSON semantics. This change allows users to select the validation strictness that best fits their data model requirements.
src/JsonSchema/Constraints/TypeCheck · high confidence
New CLI tools for validation, testing, and release management
The \bin\ directory now includes several new executable scripts to improve developer workflow and release processes. The \validate-json\ command-line tool allows users to validate JSON data against schemas, supporting local files, HTTP/HTTPS URLs, and automatic schema detection from HTTP headers or the \$schema\ property in the data. A new \run-test-case\ script enables running specific JSON Schema test suite cases by description, aiding in debugging and verification. Additionally, \extract-release-notes.sh\, \prepare-release.sh\, and \update-changelog.sh\ provide automation for managing the CHANGELOG.md file, allowing users to extract notes for specific versions, prepare new releases by moving unreleased changes, and add new changelog entries via command-line arguments.
bin · high confidence
New URI resolution and retrieval components
This change introduces the \UriResolver\ and \UriRetriever\ classes in the \src/JsonSchema/Uri\ namespace to handle JSON Schema URI resolution and fetching. The \UriResolver\ parses and combines URIs according to RFC 3986 rules, handling relative paths, fragments, and file-based bases. The \UriRetriever\ manages the actual retrieval of schema content, supporting local file paths, HTTP URLs, and internal \package://\ translations for bundled schema drafts. It also includes media type validation (allowing \application/json\ and \text/json\), caching of fetched schemas to support recursive resolution, and JSON pointer resolution for fragment-based schema references.
src/JsonSchema/Uri · high confidence
New entity classes for error handling and JSON pointer management
This change introduces three new classes in the src/JsonSchema/Entity directory: ErrorBag, ErrorBagProxy, and JsonPointer. ErrorBag provides a structured way to collect and manage validation errors, including details like property paths, constraint names, and error contexts, while ErrorBagProxy offers a convenient trait for classes to interact with the error bag. JsonPointer handles JSON Pointer syntax for referencing specific parts of JSON documents, supporting path manipulation and encoding/decoding. These entities form the foundation for improved error reporting and path resolution in schema validation.
src/JsonSchema/Entity · high confidence
Removals
Removal of legacy Selenium test suite
The \seleniumTests\ directory, which contained the legacy Selenium IDE test suite for the JSON validator, has been removed. This includes the main suite definition (\SUITEPhpJsJsonSchemaValidator\) and individual test cases covering basic types, arrays, patterns, and other validation rules. These tests are no longer part of the project.
seleniumTests · high confidence
Behavioural changes
New exception hierarchy with common interface for easier error handling
The library now provides a unified exception hierarchy under the JsonSchema\\Exception namespace. All custom exceptions (such as ValidationException, JsonDecodingException, and InvalidSchemaException) implement the new ExceptionInterface, allowing consumers to catch all library-specific errors with a single catch block. Additionally, JsonDecodingException now provides descriptive error messages for specific JSON decode failures (e.g., syntax errors, UTF-8 issues) instead of generic codes.
src/JsonSchema/Exception · high confidence
Refactored URI retrieval with new AbstractRetriever and dedicated implementations
The URI retrieval mechanism has been restructured to use an AbstractRetriever base class, with specific implementations for cURL, file\_get\_contents, and predefined arrays. This change introduces a PredefinedArray retriever for loading schemas from a local array, improves HTTP header parsing in the file\_get\_contents retriever to handle redirects correctly, and adds support for file:// URIs. Users relying on custom retrievers should ensure they extend the new AbstractRetriever class.
src/JsonSchema/Uri/Retrievers · high confidence
Refactored validation architecture with draft-aware constraint resolution
The validation engine has been restructured to support multiple JSON Schema drafts (03, 04, 06, 07, 2019-09, and 2020-12) through a new \DraftIdentifiers\ system and a \SchemaStorage\ component that handles URI resolution and reference expansion. The public API now uses \Validator::validate()\ instead of the deprecated \check()\ and \coerce()\ methods, and validation errors are centralized in a new \ConstraintError\ class. This change enables strict dialect-specific validation and improves how relative URIs and internal schema references are resolved.
src/JsonSchema · high confidence
Refactored validation constraints into a modular, factory-driven architecture
The validation logic in src/JsonSchema/Constraints has been restructured from a monolithic Constraint class into a set of specialized, single-responsibility constraint classes (such as CollectionConstraint, ConstConstraint, EnumConstraint, FormatConstraint, NumberConstraint, ObjectConstraint, StringConstraint, and TypeConstraint) managed by a central Factory. This change introduces a new BaseConstraint class to handle shared error reporting and path conversion, and a ConstraintInterface to standardize the validation contract. Users benefit from a more maintainable codebase and the ability to customize or replace specific validation behaviors via the Factory's setConstraintClass method, while the core validation outcomes for JSON Schema compliance remain consistent.
src/JsonSchema/Constraints · high confidence
Repository cleanup and modernization for release 6.13.1
This release cleans up the repository structure by removing legacy JavaScript-based validation tools (JsSchema.php, interface.js, jquery.js) and their associated CSS, replacing them with a modern PHP-based implementation. It introduces a new .gitattributes file to exclude development artifacts (tests, docs, CI configs) from the packaged distribution, ensuring a lighter install. The project also adopts a new MIT license, adds a SECURITY.md policy for vulnerability reporting, and establishes a CONTRIBUTING.md guide with an automated changelog workflow. Additionally, the codebase is configured with PHP CS Fixer (PSR-2/Symfony standards), PHPStan (level 8), and PHPUnit, enforcing stricter code quality and type safety.
(repo-wide) · high confidence
Fixes
Introduce custom deep comparison and deep copy utilities
Added two new utility classes, DeepComparer and DeepCopy, to the JsonSchema\\Tool namespace. DeepComparer provides a static isEqual method that treats mathematically equal numbers (e.g., 1 and 1.0) as identical during validation, addressing issues where integer and float representations of the same value were previously considered distinct. DeepCopy offers a static copyOf method that creates deep copies of input data structures by serializing and deserializing them via JSON, ensuring that sub-schema checks in oneOf validations operate on independent copies rather than shared references.
src/JsonSchema/Tool · high confidence
RFC 3986-compliant URI validation via new validator classes
Replaced the previous PHP filter-based URI validation with new userland validators (UriValidator and RelativeReferenceValidator) to ensure strict compliance with RFC 3986. This change enables support for underscores and tildes in hostnames, correctly accepts '\#' and '?' as valid URI references, and rejects percent signs that do not form valid hexadecimal triplets, providing more accurate validation for both absolute and relative URI references.
src/JsonSchema/Tool/Validator · high confidence
Test coverage
Added comprehensive test coverage for JSON Schema constraint validation; Added draft-specific test suites for JSON Schema validation; Added tests for DeepComparer and DeepCopy utilities; Added tests for the exception hierarchy; Added unit tests for JSON Schema validation components; Added unit tests for URI and relative reference validators; Added unit tests for URI resolution and retrieval; Added unit tests for URI retrievers.
Dependencies
Initial composer.json for json-schema library
The project now includes a composer.json manifest defining the library as 'justinrainbow/json-schema'. It requires PHP 7.2 or 8.0 along with the ext-filter and ext-json extensions, and depends on marc-mabe/php-enum version 4.4. Development dependencies include phpunit 8.5, php-cs-fixer 3.3.0, and phpstan 1.12. The package uses PSR-4 autoloading for the JsonSchema namespace, exposes a validate-json binary, and registers a custom repository for the json-schema/json-schema-test-suite.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 57.8 → 58.2 (+0.4)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 69.1 → 63.8 (-5.3)
- Architecture 87.7 → 99.2 (+11.5)
- Maturity 52.6 → 53.6 (+1.0)
- Readiness 54.9 → 54.8 (-0.1)
- Security 65.0 → 65.0 (0.0)
Resolved (14)
- Duplicated block (12 lines × 3) (src/JsonSchema/Constraints/Drafts/Draft06/MultipleOfConstraint.php)
- Duplicated block (15 lines × 2) (src/JsonSchema/Constraints/Drafts/Draft06/MultipleOfConstraint.php)
- Duplicated block (19 lines × 2) (src/JsonSchema/Constraints/Drafts/Draft07/FormatConstraint.php)
- Duplicated block (20 lines × 3) (src/JsonSchema/Constraints/Drafts/Draft06/PropertiesNamesConstraint.php)
- No ADRs found
- Off-boarding risk: anonymized user #1
- Orphaned file (src/JsonSchema/Constraints/BaseConstraint.php)
- Orphaned file (src/JsonSchema/Constraints/Constraint.php)
- Orphaned file (src/JsonSchema/Constraints/Factory.php)
- Orphaned file (src/JsonSchema/Constraints/NumberConstraint.php)
- Orphaned file (src/JsonSchema/Constraints/SchemaConstraint.php)
- Orphaned file (src/JsonSchema/Iterator/ObjectIterator.php)
- Orphaned files with no living knowledge
- Projects may be oversized for their cohesion
New (16)
- Duplicated block (17 lines × 3) (src/JsonSchema/Constraints/Drafts/Draft06/MultipleOfConstraint.php)
- Edited copies of one member (3 members, 36+ corresponding lines) (src/JsonSchema/Constraints/Drafts/Draft06/AdditionalItemsConstraint.php)
- Edited copies of one member (3 members, 4+ corresponding lines) (src/JsonSchema/Constraints/Drafts/Draft06/Draft06Constraint.php)
- Edited copies of one member (4 members, 4+ corresponding lines) (src/JsonSchema/Constraints/Drafts/Draft06/FormatConstraint.php)
- Edited copy of a member (11 corresponding lines) (src/JsonSchema/Constraints/Drafts/Draft06/FormatConstraint.php)
- Edited copy of a member (11 corresponding lines) (src/JsonSchema/Constraints/TypeConstraint.php)
- Edited copy of a member (12 corresponding lines) (src/JsonSchema/Uri/UriResolver.php)
- Edited copy of a member (13 corresponding lines) (src/JsonSchema/Constraints/BaseConstraint.php)
- Edited copy of a member (18 corresponding lines) (src/JsonSchema/Uri/UriResolver.php)
- Edited copy of a member (5 corresponding lines) (src/JsonSchema/Constraints/Constraint.php)
- Edited copy of a member (73 corresponding lines) (src/JsonSchema/Constraints/Drafts/Draft07/FormatConstraint.php)
- Hotspot: src/JsonSchema/Uri/UriResolver.php (src/JsonSchema/Uri/UriResolver.php)
- No ADRs found (composer.json)
- Off-boarding risk: anonymized user #1
- UriResolver.resolve (cognitive 18) (src/JsonSchema/Uri/UriResolver.php)
- UriResolver.resolve (cyclomatic 18) (src/JsonSchema/Uri/UriResolver.php)
Changes since last survey
- 8 commits — 6 feature/other, 2 fixes
By area
- (root) — 4 commits
- src/JsonSchema — 3 commits
- .github/workflows — 1 commit
Notable commits
- fix: fix: Ignore a non-positive multipleOf in Draft-06 and Draft-07 (#997)
- fix: fix: Merge errors in linear time (#994)
- change: Stop inheriting the query and fragment of the base URI (#951)
- change: ci: Run the 32-bit job on ubuntu-24.04 (#996)
- change: docs: Update CHANGELOG.md for PR #951
- change: docs: Update CHANGELOG.md for PR #994
- change: docs: Update CHANGELOG.md for PR #996
- change: docs: Update CHANGELOG.md for PR #997
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
jsonrainbow/json-schema was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit c25bb4a2fc8749a3777410a455e786f46f99ee62 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.