woocommerce / remote-specs-validation
远程规格测试套件
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-09-09 04:15:39 UTC
README
安装
composer require woocommerce/remote-specs-validation
可用的模式
与模式协同工作
如果您是第一次使用JSON模式,我们强烈建议您先阅读https://json-schema.fullstack.org.cn/learn/getting-started-step-by-step。
- 从
schemas
目录中打开模式文件。 - 进行更改。
- 运行
./bin/build schemas/:name-of-schema-file
- 捆绑的模式文件将保存在
bundles
目录中。
验证示例
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!'); }