Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Json Schema Assertions Laravel Package

sixlive/laravel-json-schema-assertions

Validate JSON responses and payloads against JSON Schema definitions in your Laravel tests. Adds expressive assertions like assertJsonSchema so you can verify API structure and contracts with minimal setup.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What the package is: sixlive/laravel-json-schema-assertions is a dev-only Laravel testing utility that adds JSON Schema assertion helpers (e.g. assertJsonSchema) to Laravel's TestResponse, removing hand-written structural assertions from feature/API tests.

Architecture fit: Very narrow, intentionally so. It registers a service provider and extends the framework's test response macro surface — it does not touch application runtime, HTTP layer, persistence, or auth. That makes it architecturally inert in production and low-coupling in test code. The trade-off is that it is a "convenience over opis/json-schema" wrapper: the value is ergonomics, not unique capability, so the build-vs-buy calculation is genuinely close.

Integration feasibility: Straightforward. composer require --dev, optional config publish for schema path resolution, then a one-line assertion in existing tests. No application code changes, no migrations, no env vars. The realistic effort is in authoring/curating JSON Schema documents, not in wiring the package.

Technical risk: Low, and this release reduces rather than adds risk. v4.4.0 is a maintenance release with two changes: PHPUnit deprecation fixes (PR #33) and Laravel 12.x compatibility (PR #34, via Laravel Shift). There are no new features, no API changes, no deprecations, and no configuration changes — a patch/minor bump that is drop-in from v4.3.2. The residual risks are structural, not release-specific: single-maintainer project, a small contributor base, and a compatibility model that trails Laravel majors by community PR rather than by maintainer commitment. Laravel 12 support arriving via an automated Shift PR is a positive signal but also evidence that framework-major readiness is reactive.

Key questions for the maintainer/team:

  • What is the supported matrix for PHP, Laravel, PHPUnit, and Pest, and is it documented and CI-enforced?
  • Does the PHPUnit deprecation fix cover PHPUnit 11/12, or only the currently pinned major? Will the next PHPUnit major require another patch?
  • Which JSON Schema draft and validator backend (opis/json-schema or justinrainbow/json-schema) is used, and what are the version constraints and known spec gaps?
  • Is there a stated policy/timeline for Laravel major support (e.g. within N weeks of GA)?
  • Bus factor: is there a second maintainer or a fork/transfer contingency?

Integration Approach

Stack fit: Appropriate for any Laravel 10–12 service with a versioned public API or contract-tested JSON responses. It is a poor fit for teams already standardizing on OpenAPI-driven contract testing (Schemathesis, Dredd, Pact) or on Pest architecture presets — in those cases it duplicates an existing validation layer and adds a second source of truth for response shape.

Migration path: v4.3.2 → v4.4.0 is a no-risk, drop-in upgrade; pin to ^4.4 in require-dev. Teams still on v3 should note that the v3→v4 line did involve namespace/API changes and a config reshuffle, so that jump needs a dedicated branch and a test-suite run. The genuinely expensive migration is not the package upgrade but the schema authoring: converting existing ad-hoc assertJsonStructure/assertJsonCount assertions into schema files is where the effort lands, and it should be scoped as test-debt remediation rather than as a dependency bump.

Compatibility: The Laravel 12 compatibility in this release is the headline item — it unblocks adoption of Laravel 12 for any team that has this package in its dev dependency set, and conversely it was likely a hard blocker for upgrading (composer conflicts on illuminate/* constraints would have forced a removal or a fork). The PHPUnit deprecation fix reduces noise in CI output and lowers the chance of a hard break at the next PHPUnit major. Verify the package's own constraints resolve cleanly against your locked phpunit/phpunit, pestphp/pest, and laravel/framework versions before rollout.

Sequencing:

  1. Bump to ^4.4 in require-dev on a branch; run the full suite to confirm no assertion regressions from the PHPUnit changes.
  2. Add the package to the CI matrix for the lowest and highest supported Laravel/PHP versions you intend to run.
  3. Pilot schema assertions on one high-value API resource (the endpoint with the most churn in its response shape) before broad adoption.
  4. If Laravel 12 adoption is on the roadmap, land this bump first so the framework upgrade is not blocked by a dev dependency.
  5. Only after the pilot proves out, fold schema files into the code review checklist for API changes.

Operational Impact

Maintenance: Near-zero ongoing cost — dev-only dependency, no runtime footprint, no security surface in production artifacts. The real maintenance burden is the schema corpus: schemas are code, they need review, versioning alongside API changes, and occasional refactoring. Budget for that ownership explicitly (an API platform or backend guild) or the schemas will silently rot and produce false confidence.

Support: Community-supported, single primary maintainer. Acceptable for a test-only dependency where failure mode is a red build, not an outage. Not acceptable as a critical-path dependency for compliance-driven contract guarantees without an internal fork plan.

Scaling: Negligible. Validation runs only in test processes; cost is proportional to the number of assertions and schema complexity, which can add measurable seconds to large suites. Mitigate with parallel test execution and by asserting schemas at the contract boundary rather than on every fixture. No horizontal scaling concerns.

Failure modes:

  • Framework-major stall: no Laravel 13 support for a quarter → composer conflict blocks the app upgrade because of a test helper. This has now happened once (fixed here) and is the most likely recurring issue. Mitigation: keep the dependency unpinned enough to swap, and know that removing it is a one-day change.
  • Schema drift: API changes ship without schema updates → tests pass while the contract is wrong. Mitigation: treat schema files as reviewable artifacts tied to the endpoints they cover.
  • Strictness mismatch: overly strict schemas (e.g. additionalProperties: false, required-nullable confusion) cause brittle failures and eventual bypassing of the assertion.
  • Validator semantics: draft/version gaps in the underlying validator producing surprising pass/fail results; pin the validator and document the draft in use.
  • PHPUnit major upgrade: another deprecation cycle could break assertion signatures again — validate on the PHPUnit beta channel, not at GA.

Ramp-up: Trivial for anyone already writing Laravel feature tests — a single new assertion method plus JSON Schema familiarity. Allow roughly half a day to a day per engineer, plus a shared internal example/schema template so the team converges on one style rather than five. The scarce skill is JSON Schema authoring discipline, not the package itself; invest the onboarding time there, not in the API surface.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core