Skip to content

Commit d2c8457

Browse files
committed
Update metadata serialization and test
1 parent 2f1d675 commit d2c8457

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

crates/wasm-pkg-core/src/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub const CONFIG_FILE_NAME: &str = "wkg.toml";
1616
/// The structure for a wkg.toml configuration file. This file is entirely optional and is used for
1717
/// overriding and annotating wasm packages.
1818
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
19+
#[serde(deny_unknown_fields)]
1920
pub struct Config {
2021
/// Overrides for various packages
2122
#[serde(default, skip_serializing_if = "Option::is_none")]
@@ -59,6 +60,7 @@ impl Config {
5960
}
6061

6162
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
63+
#[serde(deny_unknown_fields)]
6264
pub struct Override {
6365
/// A path to the package on disk. If this is set, the package will be loaded from the given
6466
/// path. If this is not set, the package will be loaded from the registry.
@@ -71,18 +73,19 @@ pub struct Override {
7173
}
7274

7375
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
76+
#[serde(deny_unknown_fields)]
7477
pub struct Metadata {
75-
/// The authors of the package.
78+
/// The author(s) of the package.
7679
#[serde(default, skip_serializing_if = "Option::is_none")]
7780
pub author: Option<String>,
7881
/// The package description.
7982
#[serde(default, skip_serializing_if = "Option::is_none")]
8083
pub description: Option<String>,
8184
/// The package license.
82-
#[serde(default, skip_serializing_if = "Option::is_none")]
85+
#[serde(default, skip_serializing_if = "Option::is_none", alias = "license")]
8386
pub licenses: Option<String>,
8487
/// The package source code URL.
85-
#[serde(default, skip_serializing_if = "Option::is_none")]
88+
#[serde(default, skip_serializing_if = "Option::is_none", alias = "repository")]
8689
pub source: Option<String>,
8790
/// The package homepage URL.
8891
#[serde(default, skip_serializing_if = "Option::is_none")]
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[metadata]
2-
authors = ["WasmPkg <[email protected]>"]
3-
categories = ["wasm-pkg"]
2+
author = "WasmPkg <[email protected]>"
43
description = "WASI HTTP interface"
54
license = "Apache-2.0"
6-
documentation = "https://docs.foobar.baz"
5+
source = "https://github.com/bytecodealliance/wasm-pkg-tools"
76
homepage = "https://foobar.baz/"
8-
repository = "https://github.com/bytecodealliance/wasm-pkg-tools"
7+
revision = "abcd123"

0 commit comments

Comments
 (0)