pub struct ConfigManager<F: FileSystem> { /* private fields */ }Implementations§
Source§impl<F: FileSystem> ConfigManager<F>
impl<F: FileSystem> ConfigManager<F>
pub const fn with_fs(fs: F, config_dir: PathBuf) -> Self
Sourcepub fn config_dir(&self) -> &Path
pub fn config_dir(&self) -> &Path
Get the configuration directory path
Sourcepub fn skipped_endpoints_to_warnings(
skipped_endpoints: &[SkippedEndpoint],
) -> Vec<ValidationWarning>
pub fn skipped_endpoints_to_warnings( skipped_endpoints: &[SkippedEndpoint], ) -> Vec<ValidationWarning>
Convert skipped endpoints to validation warnings for display
Sourcepub fn get_strict_preference(&self, api_name: &str) -> Result<bool, Error>
pub fn get_strict_preference(&self, api_name: &str) -> Result<bool, Error>
Get the strict mode preference for an API
§Errors
Returns an error if the global config cannot be loaded
Sourcepub fn format_validation_warnings(
warnings: &[ValidationWarning],
total_operations: Option<usize>,
indent: &str,
) -> Vec<String>
pub fn format_validation_warnings( warnings: &[ValidationWarning], total_operations: Option<usize>, indent: &str, ) -> Vec<String>
Display validation warnings with custom prefix
Sourcepub fn display_validation_warnings(
warnings: &[ValidationWarning],
total_operations: Option<usize>,
)
pub fn display_validation_warnings( warnings: &[ValidationWarning], total_operations: Option<usize>, )
Display validation warnings to stderr
Sourcepub fn add_spec(
&self,
name: &str,
file_path: &Path,
force: bool,
strict: bool,
) -> Result<(), Error>
pub fn add_spec( &self, name: &str, file_path: &Path, force: bool, strict: bool, ) -> Result<(), Error>
Adds a new OpenAPI specification to the configuration from a local file.
§Errors
Returns an error if:
- The spec already exists and
forceis false - File I/O operations fail
- The
OpenAPIspec is invalid YAML - The spec contains unsupported features
§Panics
Panics if the spec path parent directory is None (should not happen in normal usage).
Sourcepub async fn add_spec_from_url(
&self,
name: &str,
url: &str,
force: bool,
strict: bool,
) -> Result<(), Error>
pub async fn add_spec_from_url( &self, name: &str, url: &str, force: bool, strict: bool, ) -> Result<(), Error>
Adds a new OpenAPI specification to the configuration from a URL.
§Errors
Returns an error if:
- The spec already exists and
forceis false - Network requests fail
- The
OpenAPIspec is invalid YAML - The spec contains unsupported features
- Response size exceeds 10MB limit
- Request times out (30 seconds)
§Panics
Panics if the spec path parent directory is None (should not happen in normal usage).
Sourcepub async fn add_spec_auto(
&self,
name: &str,
file_or_url: &str,
force: bool,
strict: bool,
) -> Result<(), Error>
pub async fn add_spec_auto( &self, name: &str, file_or_url: &str, force: bool, strict: bool, ) -> Result<(), Error>
Adds a new OpenAPI specification from either a file path or URL.
This is a convenience method that automatically detects whether the input is a URL or file path and calls the appropriate method.
§Errors
Returns an error if:
- The spec already exists and
forceis false - File I/O operations fail (for local files)
- Network requests fail (for URLs)
- The
OpenAPIspec is invalid YAML - The spec contains unsupported features
- Response size exceeds 10MB limit (for URLs)
- Request times out (for URLs)
Sourcepub fn remove_spec(&self, name: &str) -> Result<(), Error>
pub fn remove_spec(&self, name: &str) -> Result<(), Error>
Removes an API specification from the configuration.
§Errors
Returns an error if the spec does not exist or cannot be removed.
Sourcepub fn edit_spec(&self, name: &str) -> Result<(), Error>
pub fn edit_spec(&self, name: &str) -> Result<(), Error>
Opens an API specification in the default editor.
§Errors
Returns an error if:
- The spec does not exist.
- The
$EDITORenvironment variable is not set. - The editor command fails to execute.
Sourcepub fn load_global_config(&self) -> Result<GlobalConfig, Error>
pub fn load_global_config(&self) -> Result<GlobalConfig, Error>
Loads the global configuration from config.toml.
§Errors
Returns an error if the configuration file exists but cannot be read or parsed.
Sourcepub fn save_global_config(&self, config: &GlobalConfig) -> Result<(), Error>
pub fn save_global_config(&self, config: &GlobalConfig) -> Result<(), Error>
Saves the global configuration to config.toml.
§Errors
Returns an error if the configuration cannot be serialized or written.
Sourcepub fn set_setting(
&self,
key: &SettingKey,
value: &SettingValue,
) -> Result<(), Error>
pub fn set_setting( &self, key: &SettingKey, value: &SettingValue, ) -> Result<(), Error>
Sourcepub fn get_setting(&self, key: &SettingKey) -> Result<SettingValue, Error>
pub fn get_setting(&self, key: &SettingKey) -> Result<SettingValue, Error>
Sourcepub fn list_settings(&self) -> Result<Vec<SettingInfo>, Error>
pub fn list_settings(&self) -> Result<Vec<SettingInfo>, Error>
Lists all available configuration settings with their current values.
§Errors
Returns an error if the config file cannot be read or parsed.
Sourcepub fn set_url(
&self,
api_name: &str,
url: &str,
environment: Option<&str>,
) -> Result<(), Error>
pub fn set_url( &self, api_name: &str, url: &str, environment: Option<&str>, ) -> Result<(), Error>
Sourcepub fn get_url(
&self,
api_name: &str,
) -> Result<(Option<String>, HashMap<String, String>, String), Error>
pub fn get_url( &self, api_name: &str, ) -> Result<(Option<String>, HashMap<String, String>, String), Error>
Sourcepub fn list_urls(
&self,
) -> Result<HashMap<String, (Option<String>, HashMap<String, String>)>, Error>
pub fn list_urls( &self, ) -> Result<HashMap<String, (Option<String>, HashMap<String, String>)>, Error>
Sourcepub fn set_secret(
&self,
api_name: &str,
scheme_name: &str,
env_var_name: &str,
) -> Result<(), Error>
pub fn set_secret( &self, api_name: &str, scheme_name: &str, env_var_name: &str, ) -> Result<(), Error>
Sets a secret configuration for a specific security scheme
§Arguments
api_name- The name of the API specificationscheme_name- The name of the security schemeenv_var_name- The environment variable name containing the secret
§Errors
Returns an error if the spec doesn’t exist or config cannot be saved.
Sourcepub fn list_secrets(
&self,
api_name: &str,
) -> Result<HashMap<String, ApertureSecret>, Error>
pub fn list_secrets( &self, api_name: &str, ) -> Result<HashMap<String, ApertureSecret>, Error>
Sourcepub fn get_secret(
&self,
api_name: &str,
scheme_name: &str,
) -> Result<Option<ApertureSecret>, Error>
pub fn get_secret( &self, api_name: &str, scheme_name: &str, ) -> Result<Option<ApertureSecret>, Error>
Sourcepub fn set_secret_interactive(&self, api_name: &str) -> Result<(), Error>
pub fn set_secret_interactive(&self, api_name: &str) -> Result<(), Error>
Configure secrets interactively for an API specification
Loads the cached spec to discover available security schemes and presents an interactive menu for configuration.
§Arguments
api_name- The name of the API specification
§Errors
Returns an error if:
- The spec doesn’t exist
- Cannot load cached spec
- User interaction fails
- Cannot save configuration
§Panics
Panics if the selected scheme is not found in the cached spec (this should never happen due to menu validation)