Skip to main content

openapi_nexus/generators/python/httpx/
config.rs

1//! Python httpx generator-specific configuration.
2
3use serde::{Deserialize, Serialize};
4use tracing::error;
5
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct PythonHttpxConfig {
8    #[serde(default)]
9    pub package_name: Option<String>,
10}
11
12impl From<toml::value::Table> for PythonHttpxConfig {
13    fn from(value: toml::value::Table) -> Self {
14        use serde::Deserialize;
15        match PythonHttpxConfig::deserialize(value) {
16            Ok(config) => config,
17            Err(e) => {
18                error!(
19                    "Failed to parse Python httpx config: {}. Using default configuration.",
20                    e
21                );
22                Self::default()
23            }
24        }
25    }
26}