From 104704cb8868580ff1ecbf3f9910c1b68fa1ef77 Mon Sep 17 00:00:00 2001 From: Brian Carlsen Date: Sun, 13 Nov 2022 17:27:33 +0100 Subject: [PATCH] Fixed serialization issue for snake_case to CamelCase. --- src/dialog.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dialog.rs b/src/dialog.rs index 7f133f0..2127741 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -5,7 +5,7 @@ //! ```rust,no_run //! use tauri_api::dialog::open; //! -//! let path = open.await; +//! let path = open(None).await; //! ``` use serde::Serialize; use std::path::PathBuf; @@ -61,6 +61,7 @@ impl MessageDialogOptions { #[derive(Serialize)] pub struct OpenDialogOptions { /// Initial directory or file path. + #[serde(rename(serialize = "defaultPath"))] pub default_path: Option, /// Whether the dialog is a directory selection or not. @@ -101,6 +102,7 @@ pub struct SaveDialogOptions { /// If it's not a directory path, the dialog interface will change to that folder. /// If it's not an existing directory, the file name will be set to the dialog's /// file name input and the dialog will be set to the parent folder. + #[serde(rename(serialize = "defaultPath"))] pub default_path: Option, /// The filters of the dialog.