diff --git a/src/Generator/WebHook.php b/src/Generator/WebHook.php index f23230f..cf4355e 100644 --- a/src/Generator/WebHook.php +++ b/src/Generator/WebHook.php @@ -106,6 +106,23 @@ public static function generate(string $namespace, string $event, SchemaRegistry 'stmts' => [ new Node\Stmt\TryCatch([ ...$headers, + new Node\Stmt\Expression(new Node\Expr\MethodCall( + new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'requestSchemaValidator' + ), + new Node\Name('validate'), + [ + new Node\Arg(new Node\Expr\Variable('data')), + new Node\Arg(new Node\Expr\StaticCall(new Node\Name('\cebe\openapi\Reader'), new Node\Name('readFromJson'), [ + new Node\Expr\ClassConstFetch( + new Node\Name('Schema\\' . $schema->className), + new Node\Name('SCHEMA_JSON'), + ), + new Node\Scalar\String_('\cebe\openapi\spec\Schema'), + ])), + ] + )), new Node\Stmt\Return_(new Node\Expr\MethodCall( new Node\Expr\PropertyFetch( new Node\Expr\Variable('this'),