oschema: tighten root-object detection to require [rootobject] marker #108
No reviewers
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!108
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "strict-rootobject-marker"
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?
Summary
The parser previously marked an object as a root object if it carried either the
[rootobject]comment marker or asid: strfield. Three of four codegen targets (Rust SDK trait, OpenRPC spec, UI scaffolds) honoured the OR; the OSIS server-side dispatcher emitter only honoured the marker. Result: a schema withsid: strand no marker would land in the SDK + OpenRPC + UI surfaces but silently skip the server dispatcher — every CRUD call would resolve to "Unknown method" at runtime.Tightens to a single signal — the explicit
[rootobject]marker — at the one place that matters (crates/oschema/src/parser.rs), then drops the now-redundanthas_sid || obj.is_root_objectchecks in every downstream collector. One rule, one detection site, no silent divergence.Affected places
crates/oschema/src/parser.rs— sole detection site, marker-only.crates/generator/src/build/emit/rust_rpc2.rs— drops the OR.crates/generator/src/build/ui_emit.rs— drops the OR.crates/generator/src/schemas/openrpc.rs— drops the OR.crates/generator/src/rust/rust_rpc.rs— drops the OR (two sites).crates/generator/src/generate/examples.rs— drops the OR.crates/generator/src/generate/e2e.rs— drops the OR.crates/generator/src/schemas/oschema.rs::is_root_object— drops the sid-fallback.Fixture updates
Inline test schemas that relied on sid-auto-detection gain explicit
# <TypeName> [rootobject]headers (rust_rpc2.rs,ui_emit.rs,openrpc.rs,rhai_struct.rs). Every real.oschemashipped in the repo already carried the marker — no on-disk schemas needed editing. The walkthrough's demo schema doc-comment was tightened to drop the "must carry a sid: str field" misdirection (sid / created_at / updated_at are server-managed, the codegen injects them).Test plan
cargo test --workspace --libpasses.examples/recipe_server/end-to-endcargo buildstill passes.cargo run --manifest-path examples/recipe_server/Cargo.toml --example 01_walkthroughstill produces the expected output (7 CRUD methods + service method in step 4, full dispatch arm in step 5).