pub struct CodeGenerator { /* private fields */ }Implementations§
Source§impl CodeGenerator
impl CodeGenerator
Sourcepub fn generate_http_client_struct(&self) -> TokenStream
pub fn generate_http_client_struct(&self) -> TokenStream
Generate the HTTP client struct with middleware support
Sourcepub fn generate_operation_methods(
&self,
analysis: &SchemaAnalysis,
) -> TokenStream
pub fn generate_operation_methods( &self, analysis: &SchemaAnalysis, ) -> TokenStream
Generate HTTP operation methods for the client.
Emits per-operation typed error enums (one variant per declared non-2xx
response with a body schema) BEFORE the impl HttpClient block so the
generated method signatures can reference them. This low-level helper
intentionally emits every analyzed operation; use
Self::generate_http_client or Self::generate_all to honor the
configured [client].operations scope.
Source§impl CodeGenerator
impl CodeGenerator
pub fn new(config: GeneratorConfig) -> Self
Sourcepub fn with_source_provenance(self, source: impl Into<String>) -> Self
pub fn with_source_provenance(self, source: impl Into<String>) -> Self
Attach a sanitized source label to generated module headers.
Sourcepub fn config(&self) -> &GeneratorConfig
pub fn config(&self) -> &GeneratorConfig
Get reference to the generator configuration
Sourcepub fn generate_all(
&self,
analysis: &mut SchemaAnalysis,
) -> Result<GenerationResult>
pub fn generate_all( &self, analysis: &mut SchemaAnalysis, ) -> Result<GenerationResult>
Generate all files for the API
Sourcepub fn generate(&self, analysis: &mut SchemaAnalysis) -> Result<String>
pub fn generate(&self, analysis: &mut SchemaAnalysis) -> Result<String>
Generate just the types (legacy single-file interface)
Sourcepub fn generate_http_client(&self, analysis: &SchemaAnalysis) -> Result<String>
pub fn generate_http_client(&self, analysis: &SchemaAnalysis) -> Result<String>
Generate HTTP client code for regular (non-streaming) requests.
This standalone entry point honors [client].operations but does not
validate unrelated server or streaming scopes. Use Self::generate_all
when generating the complete configured output set.
Sourcepub fn output_artifacts(
&self,
result: &GenerationResult,
) -> BTreeMap<PathBuf, String>
pub fn output_artifacts( &self, result: &GenerationResult, ) -> BTreeMap<PathBuf, String>
Helper method to write all generated files to disk
Sourcepub fn write_files(&self, result: &GenerationResult) -> Result<()>
pub fn write_files(&self, result: &GenerationResult) -> Result<()>
Write a generation result using the same rendered artifact set exposed to dry-run and check-mode callers.
Sourcepub fn is_rust_keyword(s: &str) -> bool
pub fn is_rust_keyword(s: &str) -> bool
Check if a string is a Rust keyword that needs raw identifier treatment
Sourcepub fn to_field_ident(name: &str) -> Ident
pub fn to_field_ident(name: &str) -> Ident
Create a proc_macro2::Ident from a field name, handling r# raw identifiers
Source§impl CodeGenerator
impl CodeGenerator
Sourcepub fn generate_registry(&self, analysis: &SchemaAnalysis) -> Result<String>
pub fn generate_registry(&self, analysis: &SchemaAnalysis) -> Result<String>
Generate the registry.rs file content