From b3b9414b7d1d0bb81f0fa9ab927c64709b4f64e2 Mon Sep 17 00:00:00 2001 From: ByteOtter Date: Mon, 22 Jan 2024 15:26:30 +0100 Subject: [PATCH] Add dervie to struct generation --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/bindgen.rs | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c881be..1e954f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,7 +215,7 @@ dependencies = [ [[package]] name = "thanix" -version = "0.1.0-alpha.5" +version = "0.1.0-alpha.6" dependencies = [ "clap", "convert_case", diff --git a/Cargo.toml b/Cargo.toml index 6400c30..09fe6b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "thanix" authors = ["Christopher Hock "] -version = "0.1.0-alpha.5" +version = "0.1.0-alpha.6" publish = true edition = "2021" description = "A yaml-to-rust code generator for generating Rust code from yaml config files e.g. as found in openAPI." diff --git a/src/bindgen.rs b/src/bindgen.rs index 8f9ceb8..90a527c 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -327,13 +327,7 @@ pub fn gen(input_path: impl AsRef) { let mut type_result = match yaml_type { // "string" can mean either a plain or formatted string or an enum declaration. - "string" => match &prop.format { - Some(x) => match x.as_str() { - "uri" => "Url".to_owned(), - _ => "String".to_owned(), - }, - None => "String".to_owned(), - }, + "string" => "String".to_owned(), "integer" => "i64".to_owned(), "number" => "f64".to_owned(), "boolean" => "bool".to_owned(),