Skip to content

Commit

Permalink
Merge pull request #20 from golemcloud/multipart-field-object
Browse files Browse the repository at this point in the history
Implement MultipartField for objects
  • Loading branch information
vigoo authored Sep 18, 2024
2 parents 5ae9bb7 + a2f517a commit 7dddf1d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/rust/model_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,26 @@ pub fn model_gen(reference: &str, open_api: &OpenAPI, ref_cache: &mut RefCache)
.reduce(|acc, e| acc + e)
.unwrap_or_else(unit),
)
+ line(unit() + "}");
+ line(unit() + "}")
+ NewLine
+ line(
unit()
+ "impl "
+ rust_name("crate::model", "MultipartField")
+ " for "
+ &name
+ "{",
)
+ indented(
line(unit() + "fn to_multipart_field(&self) -> String {")
+ indented(line("serde_json::to_string(self).unwrap()"))
+ line("}")
+ NewLine
+ line(unit() + "fn mime_type(&self) -> &'static str {")
+ indented(line(r#""application/json""#))
+ line("}"),
)
+ line("}");

Ok(code)
}
Expand Down

0 comments on commit 7dddf1d

Please sign in to comment.