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
//! Generate typed Rust models, async HTTP/SSE clients, and opt-in Axum server
//! scaffolding from OpenAPI 3.0 and 3.1 documents (with experimental 3.2
//! parsing).
//!
//! Most users should install the `openapi-to-rust` CLI and start with
//! `openapi-to-rust generate <SOURCE>`. The library API is useful when a build
//! tool or application needs to analyze and render a document in memory.
//!
//! # Library example
//!
//! ```
//! use openapi_to_rust::{CodeGenerator, GeneratorConfig, SchemaAnalyzer};
//! use serde_json::json;
//!
//! # fn main() -> openapi_to_rust::Result<()> {
//! let spec = json!({
//! "openapi": "3.1.0",
//! "info": { "title": "Example", "version": "1.0.0" },
//! "paths": {},
//! "components": {
//! "schemas": {
//! "Greeting": {
//! "type": "object",
//! "required": ["message"],
//! "properties": { "message": { "type": "string" } }
//! }
//! }
//! }
//! });
//!
//! let mut analyzer = SchemaAnalyzer::new(spec)?;
//! let mut analysis = analyzer.analyze()?;
//! let generator = CodeGenerator::new(GeneratorConfig {
//! enable_async_client: false,
//! ..GeneratorConfig::default()
//! });
//! let source = generator.generate(&mut analysis)?;
//! assert!(source.contains("pub struct Greeting"));
//! # Ok(())
//! # }
//! ```
//!
//! Configuration is documented in [`config`]. Generated dependency fragments
//! are represented by [`DepRequirement`], and generated files can be written
//! with [`CodeGenerator::write_files`].
/// Helpers for generator snapshot and scratch-crate tests.
///
/// This module is excluded from default builds so its test-only dependencies
/// do not become part of the installed CLI. Enable the `test-helpers` feature
/// when using these helpers outside this repository's test suite.
/// Crate version, exposed so embedders (e.g. the WASM playground) can report
/// which generator produced their output.
pub const VERSION: &str = env!;
pub use ;
pub use ConfigFile;
pub use GeneratorError;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub type Result<T> = Result;