浏览代码

make description optional

Lucas Nogueira 2 年之前
父节点
当前提交
f514d655b6

+ 1 - 1
core/tauri-build/src/plugin.rs

@@ -25,7 +25,7 @@ pub fn set_manifest(mut manifest: Manifest) {
       manifest.capabilities.push(Capability {
         id: feature_capability_id,
         component: None,
-        description: format!("Allows the {feature} functionality"),
+        description: Some(format!("Allows the {feature} functionality")),
         features: vec![feature.clone()],
         scope: Default::default(),
       });

+ 4 - 2
core/tauri-config-schema/schema.json

@@ -2272,7 +2272,6 @@
       "type": "object",
       "required": [
         "capabilities",
-        "description",
         "id",
         "members"
       ],
@@ -2283,7 +2282,10 @@
         },
         "description": {
           "description": "Describes the namespace in a human readable format.",
-          "type": "string"
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "members": {
           "description": "The windows that can use the configuration of this namespace.",

+ 2 - 2
core/tauri-utils/src/config.rs

@@ -1932,7 +1932,7 @@ pub struct Namespace {
   /// It is recommended to use `drop-` or `allow-` prefixes to ensure the rule can be easily categorized.
   pub id: String,
   /// Describes the namespace in a human readable format.
-  pub description: String,
+  pub description: Option<String>,
   /// The windows that can use the configuration of this namespace.
   pub members: Vec<String>,
   /// List of capabilities attached to this namespace.
@@ -2670,7 +2670,7 @@ mod build {
   impl ToTokens for Namespace {
     fn to_tokens(&self, tokens: &mut TokenStream) {
       let id = str_lit(&self.id);
-      let description = str_lit(&self.description);
+      let description = opt_str_lit(self.description.as_ref());
       let members = vec_lit(&self.members, str_lit);
       let capabilities = vec_lit(&self.capabilities, str_lit);
 

+ 1 - 1
core/tauri-utils/src/plugin.rs

@@ -44,7 +44,7 @@ pub struct Capability {
   /// When no value is set, it referes to the application itself.
   pub component: Option<String>,
   /// Describes the capability in a human readable format.
-  pub description: String,
+  pub description: Option<String>,
   /// List of features enabled by this capability.
   #[serde(default)]
   pub features: Vec<String>,

+ 4 - 2
tooling/cli/schema.json

@@ -2272,7 +2272,6 @@
       "type": "object",
       "required": [
         "capabilities",
-        "description",
         "id",
         "members"
       ],
@@ -2283,7 +2282,10 @@
         },
         "description": {
           "description": "Describes the namespace in a human readable format.",
-          "type": "string"
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "members": {
           "description": "The windows that can use the configuration of this namespace.",