Expand description
Build-time codegen helpers for the proto-first authoring path.
Phase-1 surface (impl-plan task 1.10):
Config::compilerunsprotoc(or accepts a precompiled FDS), hands the FDS tobuffa-buildfor Rust-type generation, then walks the FDS viabuffa-reflectto extract the(obs.v1.event)and(obs.v1.field)custom options out of each message’sMessageOptions.__buffa_unknown_fields. From those bytes the codegen emitsEventSchemaimpls,EventSchemaErasedimpls, andlinkmeregistrations intoOUT_DIR/obs/schemas.rs.- The byte-identical-output property described in spec 12 § 1.2 (proto-first vs Rust-first land on the same generated bytes when the schemas are equivalent) is verified via Phase-2 task 2.1 integration tests; Phase 1 ships the codegen, the test harness builds on top.
See spec 12 § 4 + spec 14 § 7.
Re-exports§
pub use lints::LintError;pub use lints::LintField;pub use lints::LintInput;pub use lints::LintProtoType;pub use lints::emit_cross_event_lints;pub use lints::emit_lints;
Modules§
- lints
- Shared lint emission for the proto-first (
obs-build::codegen) and Rust-first (obs-macros::derive_event) authoring paths. - reflect
- Reflection-based reader of
(obs.v1.event)and(obs.v1.field)options from abuffa-reflectdescriptor pool. Re-exported soobs-cli’slint/validate/schema showsubcommands can share the parser withConfig::compile.
Structs§
- Config
- Build-script entry point.
- Event
Options - Decoded
(obs.v1.event)payload. - Field
Options - Decoded
(obs.v1.field)payload. - Metric
Spec - Decoded
(obs.v1.MetricSpec).
Enums§
- Codegen
Error - Errors returned by the option scanner.
- Descriptor
Source - Source of the
FileDescriptorSet. Spec 12 § 4.
Constants§
- EMBEDDED_
ENUMS_ PROTO - Embedded canonical text of
obs/v1/enums.proto, re-exported for the same reason asEMBEDDED_OPTIONS_PROTO. - EMBEDDED_
OPTIONS_ PROTO - Embedded canonical text of
obs/v1/options.proto, re-exported so downstream consumers (e.g.obs-cli’sschema_source) can reuse it without re-vendoring.
Functions§
- materialise_
embedded_ options - Write the embedded
obs/v1/{options,enums}.protopair into{dir}/obs/v1/so a downstream protoc invocation can include them. Used by bothConfig::compileabove andobs-cli’s schema-source helper.