Download the PHP package phpnomad/opis-json-schema-integration without Composer
On this page you can find all versions of the php package phpnomad/opis-json-schema-integration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpnomad/opis-json-schema-integration
More information about phpnomad/opis-json-schema-integration
Files in phpnomad/opis-json-schema-integration
Package opis-json-schema-integration
Short Description Concrete PHPNomad JsonSchemaValidatorStrategy backed by opis/json-schema. Drop-in implementation with draft 2020-12 support.
License MIT
Homepage https://github.com/phpnomad/opis-json-schema-integration
Informations about the package opis-json-schema-integration
PHPNomad Opis JSON Schema Integration
Concrete JsonSchemaValidatorStrategy implementation backed by opis/json-schema. Drop in to satisfy phpnomad/json-schema with full draft 2020-12 support.
Requirements
PHP 8.2 or newer.
Installation
This pulls in both phpnomad/json-schema (the abstraction) and opis/json-schema (the concrete validator) automatically.
Usage
Schema resolution
The $schemaUri argument accepts:
- A local file path — the file is read and parsed as JSON before validation.
- A URI string — passed straight through to Opis's resolver. Register prefixes or IDs on the underlying
Opis\JsonSchema\Validatorbeforehand if you need custom resolution.
Custom Opis configuration
Subclass OpisJsonSchemaValidator and override the protected buildValidator() method to customize keyword registration, resolver prefixes, or other Opis behavior:
The no-arg constructor keeps the class safe to auto-wire through standard dependency injection containers.
How failures are reported
Every Opis leaf error becomes a PHPNomad\JsonSchema\ValidationFailure:
path— data pointer, dotted notation (e.g.programs.gold.incentiveType; empty string at the root).message— Opis's error message with placeholder substitution applied.keyword— the JSON Schema keyword that failed (required,type,enum, etc.).
Container errors (allOf, oneOf, anyOf) are unwrapped — only the leaf violations are surfaced, so callers see one entry per actual problem.
License
MIT