1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Proto-driven code generation from compiled protobuf descriptors.
//!
//! Turns descriptor bytes (from `buf build`) into Rust REST-API glue code (Axum
//! handlers, HTTP clients), resource registries, and optional PyO3 / NAPI /
//! TypeScript bindings. Code generation is normally driven by the `trestle` CLI
//! ([`olai-trestle`]); this is the library you embed for custom build tooling.
//!
//! ## Pipeline
//!
//! ```text
//! descriptor bytes
//! └─ parse_file_descriptor_set ─▶ CodeGenMetadata
//! └─ generate_code(&metadata, &config) ─▶ files written to CodeGenOutput dirs
//! ```
//!
//! ## Example
//!
//! ```rust,ignore
//! use std::fs;
//! use olai_codegen::{CodeGenConfig, CodeGenOutput, generate_code, parse_file_descriptor_set};
//! use protobuf::{Message, descriptor::FileDescriptorSet};
//!
//! let bytes = fs::read("descriptors.bin")?; // produced by `buf build`
//! let fds = FileDescriptorSet::parse_from_bytes(&bytes)?;
//! let metadata = parse_file_descriptor_set(&fds)?;
//!
//! let config = CodeGenConfig {
//! context_type_path: "crate::api::RequestContext".into(),
//! result_type_path: "crate::Result".into(),
//! models_path_template: "my_crate::models::{service}::v1".into(),
//! models_path_crate_template: "crate::models::{service}::v1".into(),
//! generate_resource_enum: true,
//! output: CodeGenOutput {
//! common: "out/common".into(),
//! server: Some("out/server".into()),
//! client: Some("out/client".into()),
//! ..Default::default()
//! },
//! ..Default::default()
//! };
//! config.validate()?;
//! generate_code(&metadata, &config)?;
//! ```
//!
//! [`olai-trestle`]: https://crates.io/crates/olai-trestle
pub use *;
pub use ;
pub use ;
// Note: MethodPlanner is pub(crate) — it is an internal helper, not part of the public API.
pub use run as enrich_openapi;
pub use HttpPattern;
pub use ;
pub use ;
/// The `FieldBehavior` enum from `google.api.field_behavior`, re-exported for
/// consumers that need to inspect field behavior annotations (e.g. in tests).
pub use FieldBehavior;
// Prost-generated Google API proto types — internal only.
pub
pub