Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic on config file generation #153

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ pub struct ScalaParams {
#[serde(default)]
pub struct SwiftParams {
pub prefix: String,
pub type_mappings: HashMap<String, String>,
pub default_decorators: Vec<String>,
pub default_generic_constraints: Vec<String>,
/// The contraints to apply to `CodableVoid`.
pub codablevoid_constraints: Vec<String>,
pub type_mappings: HashMap<String, String>,
}

#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug)]
Expand All @@ -49,8 +49,8 @@ pub struct TypeScriptParams {
#[cfg(feature = "go")]
pub struct GoParams {
pub package: String,
pub type_mappings: HashMap<String, String>,
pub uppercase_acronyms: Vec<String>,
pub type_mappings: HashMap<String, String>,
}

/// The paramters that are used to configure the behaviour of typeshare
Expand Down Expand Up @@ -126,6 +126,14 @@ mod test {
[CURRENT_DIR, TEST_DIR, filename].iter().collect()
}

#[test]
fn to_string_and_back() {
let path = config_file_path("mappings_config.toml");
let config = load_config(Some(path)).unwrap();

toml::from_str::<Config>(&toml::to_string_pretty(&config).unwrap()).unwrap();
}

#[test]
fn default_test() {
let path = config_file_path("default_config.toml");
Expand Down
Loading