Problem statement
Method name policy checks (blank names, reserved namespace constraints such as rpc.*, and optional naming conventions) are currently spread across components. This increases duplication and risks inconsistent enforcement.
Proposed solution
Introduce JsonRpcMethodNameValidator in jsonrpc-core as a reusable policy utility:
- validate blank/whitespace names
- enforce reserved namespace policy (
rpc.*)
- optional extension point for additional naming constraints (pattern/length/custom predicates)
Then reuse the same validator in request validation and method registration paths.
Alternatives considered
- Keep checks local in each component
- Add utility methods without a dedicated validator abstraction
These alternatives still make policy evolution harder and can reintroduce drift.
JSON-RPC behavior impact
No default protocol behavior change (current reserved namespace rejection remains). This is mainly an internal consistency and reuse improvement.
Additional context
- Keep default validator RFC-aligned and conservative.
- Ensure error mapping remains unchanged for invalid method names.
- Add tests proving consistent behavior across request validator and registration flows.
Problem statement
Method name policy checks (blank names, reserved namespace constraints such as
rpc.*, and optional naming conventions) are currently spread across components. This increases duplication and risks inconsistent enforcement.Proposed solution
Introduce
JsonRpcMethodNameValidatorinjsonrpc-coreas a reusable policy utility:rpc.*)Then reuse the same validator in request validation and method registration paths.
Alternatives considered
These alternatives still make policy evolution harder and can reintroduce drift.
JSON-RPC behavior impact
No default protocol behavior change (current reserved namespace rejection remains). This is mainly an internal consistency and reuse improvement.
Additional context