hero_rpc_generator: two bugs prevent regen of OSIS server files #135

Closed
opened 2026-05-24 14:45:36 +00:00 by zaelgohary · 1 comment
Member

Discovered while regenerating osis_server_generated.rs for hero_books (publishing domain). The generator at hero_rpc development tip (2b2aeb6c) emits code that does not compile:

Bug 1: super::core should be super::super::core

Generated header includes:

use super::core::*;

But server files live at crates/<lib>/src/<domain>/server/osis_server_generated.rs, so super:: is <domain>/server/. The core module is at <domain>/core/, reachable as super::super::core::* (or crate::<lib>::<domain>::core::*).

The old generator output (still in git) has super::super::core::* and worked correctly.

Bug 2: type field name not escaped

Schema:

Icon = {
    type: IconType   # Icon library/source
    ...
}

Generator emits:

obj.type = input.type;

but type is a Rust reserved keyword. Must emit obj.r#type = input.r#type; when the schema field name collides with a keyword (suggested rustc fix).

Repro

Any domain schema where a root object has a type field, regenerated with the v0.6.0 generator. For books specifically:

cargo run --manifest-path /tmp/regen_books_publishing/Cargo.toml

Impact

Hand-patching the regenerated file works around both, but anyone who tries cargo run hero_rpc_generator against a real existing OSIS service workspace hits these immediately.

Discovered while regenerating `osis_server_generated.rs` for hero_books (publishing domain). The generator at hero_rpc development tip (2b2aeb6c) emits code that does not compile: ## Bug 1: `super::core` should be `super::super::core` Generated header includes: use super::core::*; But server files live at `crates/<lib>/src/<domain>/server/osis_server_generated.rs`, so `super::` is `<domain>/server/`. The `core` module is at `<domain>/core/`, reachable as `super::super::core::*` (or `crate::<lib>::<domain>::core::*`). The old generator output (still in git) has `super::super::core::*` and worked correctly. ## Bug 2: `type` field name not escaped Schema: Icon = { type: IconType # Icon library/source ... } Generator emits: obj.type = input.type; but `type` is a Rust reserved keyword. Must emit `obj.r#type = input.r#type;` when the schema field name collides with a keyword (suggested rustc fix). ## Repro Any domain schema where a root object has a `type` field, regenerated with the v0.6.0 generator. For books specifically: cargo run --manifest-path /tmp/regen_books_publishing/Cargo.toml ## Impact Hand-patching the regenerated file works around both, but anyone who tries `cargo run hero_rpc_generator` against a real existing OSIS service workspace hits these immediately.
Author
Member
2ffb0a0 c61fd49 d7aa082
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_blueprint#135
No description provided.