woocommerce/remote-specs-validation

1.0.2 2024-09-09 04:12 UTC

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

  1. schemas 目录中打开模式文件。
  2. 进行更改。
  3. 运行 ./bin/build schemas/:name-of-schema-file
  4. 捆绑的模式文件将保存在 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!');
}