Skip to content

Speak the standard SkirRPC protocol - #2

Merged
happyDemon merged 2 commits into
mainfrom
skir-rpc-protocol
Nov 9, 2026
Merged

happyDemon merged 2 commits into
mainfrom
skir-rpc-protocol

Conversation

@happyDemon

@happyDemon happyDemon commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Endpoints registered with Route::skirRpc() now speak SkirRPC the way the upstream Skir service does. Any Skir client can call them: php-skir/client, or clients generated for TypeScript, Python, Go and the rest.

Request forms (see docs/protocol.md)

  • JSON object {"method": ..., "request": ...}: method is a name or a number, request may be dense or readable. Answered in readable JSON.
  • name:number:format:request: what upstream clients send. The number wins over the name; an empty number means lookup by name. Answered in dense JSON unless the format is readable.
  • GET: the colon-separated form as the query string. A bare GET (or ?studio) still renders Studio when it's enabled.

Breaking (0.2.0)

  • Removes codecs: SkirCodec, SkirCodecs, the built-in codec classes, the third argument to Route::skirRpc(), and the skir-server.codec config key. The wire format is chosen per request.
  • The old ?method=…&request=… GET form is gone.
  • Procedures are keyed by method number, like upstream. Two methods may share a name; calling an ambiguous name is rejected.
  • A handler result that doesn't match the response type now returns 500 skir_invalid_response instead of 422 skir_invalid_request.
  • null for a non-optional struct request decodes to the default struct, like upstream.

Test fixtures that relied on the old pass-through standard JSON codec now declare real request/response types.

CI checks out same-named sibling branches. This PR is tested together with php-skir/runtime#2 and php-skir/client#2. Merge order: runtime#2 → client#2 → this. Then php-skir/.github#1.

Release: the server now requires php-skir/runtime ^0.2 (it uses ReadableJson). Tag runtime v0.2.0 before tagging client/server v0.2.0.

Endpoints now accept every request form the upstream Skir service accepts:
a JSON object {method, request} answered in readable JSON, and the
colon-separated name:number:format:request form (also as a GET query
string) answered in dense JSON unless the format is readable. Methods are
looked up by number, or by name when the number is empty.

Removes the per-route and configured codecs (SkirCodec, SkirCodecs and the
skir-server.codec setting). Procedures are keyed by method number, so two
methods may share a name; calling an ambiguous name is rejected. Responses
that do not match the response type now fail with skir_invalid_response
(500) instead of skir_invalid_request.

CI checks out same-named sibling branches so cross-repo changes are tested
together.
Feature-branch checkouts otherwise report dev-<branch>, which no version
constraint matches.

The server now needs runtime 0.2 (ReadableJson), so require ^0.2.
@happyDemon
happyDemon merged commit 687add3 into main Nov 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant