Skip to main content

openapi_nexus/generators/python/requests/
config.rs

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