Generator: emit OpenRPC info.title without colon (openrpc_client! macro rejects it) #91
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_rpc#91
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
#82 landed per-domain
openrpc.jsonfiles withinfo.title = "<service>:<domain>"(e.g."LogicService:logic"). But thehero_rpc_derive::openrpc_client!macro derives Rust identifiers frominfo.titleand rejects colons.Found by the hero_logic#46 agent during the template-pattern migration — they patched the title in a
build.rspost-process step to make the macro accept it. That hack is what this issue removes.What to do
Pick one in a comment, then implement:
"<service> - <domain>"(space + dash) or"<service>_<domain>"(underscore).openrpc_client!sanitise non-identifier characters when deriving Rust idents (drop colons, replace with_, etc.).My lean: (A). Cleaner: the spec title is metadata, not an identifier. Forcing it to be Rust-ident-shaped works against its primary purpose (human-readable description). Tweaking the formatting is one-line.
Affected callers
hero_rpc/crates/derive/.crates/generator/src/generate/openrpc.rs(post-#82).build.rscurrently hand-patches the title (hero_logic does; verify others).Acceptance
hero_logic(and any other consumer) can drop thebuild.rstitle-patching step.openrpc_client!macro consumes the emitteddocs/<domain>/openrpc.jsondirectly.recipe_server+hero_serviceregenerate clean.Related
Implementation pushed on branch issue-91-92-93-generator-fixes. Bundled with the other two generator fixes from the same root (the hero_logic#46 build.rs post-process patches).
<service> - <domain>(space-dash-space). Aggregate strip logic updated to match.servers[]fromservice.toml[[binaries.sockets]]withprotocol = "openrpc", URL shapeunix://${HERO_SOCKET_DIR}/<path>soopenrpc_client!::connect()resolves viaresolve_socket_path_with_override. Per-domain narrows by binary name suffix_<domain>; aggregate keeps the union.generate_server_lib_rsdiscovers hand-written*.rs/<dir>/mod.rsmodules carrying//! @server-feature:and emitspub modlines for them. Marker-required (server crates carry internal helpers; SDK-style discover-everything would over-expose).Verified via
example/recipe_serverregen +cargo build --workspaceclean +cargo test -p hero_rpc_generator --lib(131 passed).serversblock inopenrpc.jsonsoopenrpc_client!::connect()resolves to the service's Unix socket #92generate_server_lib_rsshould auto-discover hand-written sibling modules (mirrorsgenerate_sdk_lib_rs) #93