OpenRPC Support

Generating OpenRPC specs

php bin/generate-docs.php --config=./config.php --format=openrpc --output=docs/openrpc.json

Produces an OpenRPC 1.3.2 compliant specification from your handlers.

Validation approach

The OpenRPC output is validated using:

Honest scope

The generator is validated against the bundled OpenRPC schema fixture in tests. It uses PHP-derived type information, descriptor metadata, and runtime request schemas from RpcSchemaProviderInterface when available, but it still does not attempt a full JSON Schema to OpenRPC translation layer.

The JSON Schema validator is a development dependency used in tests only. It is not required at runtime.

PHP type to JSON Schema mapping

PHP TypeJSON Schema
int{"type":"integer"}
float{"type":"number"}
bool{"type":"boolean"}
string{"type":"string"}
array{"type":"array"}
array<T>{"type":"array","items":...}
object{"type":"object"}
?T{"oneOf":[{"type":"T"},{"type":"null"}]}
mixed{"description":"Any value"}
void{"type":"null"}