woocommerce / remote-specs-validation
Remote specs testing suite
1.0.2
2024-09-09 04:12 UTC
Requires
- opis/json-schema: ^2.3
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-09 04:36:14 UTC
README
Installation
composer require woocommerce/remote-specs-validation
Available Schemas
Working with Schema
If it's your first time working with JSON Schema, we highly recommend reading https://json-schema.org/learn/getting-started-step-by-step first.
- Open a schema file from
schemas
directory. - Make changes.
- Run
./bin/build schemas/:name-of-schema-file
- Bundled schema file will be saved in
bundles
directory.
Validation Examples
use Automattic\WooCommerce\Tests\RemoteSpecsValidation\RemoteSpecValidator; $validator = RemoteSpecValidator::create_from_bundle( 'remote-inbox-notification' ); $spec = json_decode( file_get_contents(":your-remote-inbox-noficiation-json") ); $result = $validator->validate( $spec ); if ( !$result->is_valid() ) { var_dump( $result->get_errors() ); } else { var_dump('everything looks good!'); }