Skip to content

Commit dada4d8

Browse files
Merge pull request #2842 from karthik2804/manifest_serde
manifest: fix serialization of component dependency section
2 parents 02918e2 + 672a4e4 commit dada4d8

File tree

2 files changed

+21
-31
lines changed

2 files changed

+21
-31
lines changed

crates/manifest/src/schema/v2.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,12 @@ pub struct Component {
197197

198198
/// Component dependencies
199199
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
200-
#[serde(try_from = "Map<DependencyName, ComponentDependency>")]
200+
#[serde(transparent)]
201201
pub struct ComponentDependencies {
202202
/// `dependencies = { "foo:bar" = ">= 0.1.0" }`
203203
pub inner: Map<DependencyName, ComponentDependency>,
204204
}
205205

206-
impl TryFrom<Map<DependencyName, ComponentDependency>> for ComponentDependencies {
207-
type Error = anyhow::Error;
208-
209-
fn try_from(value: Map<DependencyName, ComponentDependency>) -> Result<Self, Self::Error> {
210-
Ok(ComponentDependencies { inner: value })
211-
}
212-
}
213-
214206
impl ComponentDependencies {
215207
/// This method validates the correct specification of dependencies in a
216208
/// component section of the manifest. See the documentation on the methods

crates/manifest/tests/ui/maximal.json

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,26 @@
9090
},
9191
"dependencies_inherit_configuration": true,
9292
"dependencies": {
93-
"inner": {
94-
"a:b/c": {
95-
"version": "^1.2.3",
96-
"registry": "my-registry.com",
97-
"package": "a:b",
98-
"export": "foo"
99-
},
100-
"foo:bar/[email protected]": {
101-
"path": "path/to/component.wasm",
102-
"export": null
103-
},
104-
"fib:fub/fob": {
105-
"path": "path/to/component.wasm",
106-
"export": "my-export"
107-
},
108-
"fizz:buzz": ">=0.1.0",
109-
110-
"version": "=0.1.0",
111-
"registry": null,
112-
"package": null,
113-
"export": null
114-
}
93+
"a:b/c": {
94+
"version": "^1.2.3",
95+
"registry": "my-registry.com",
96+
"package": "a:b",
97+
"export": "foo"
98+
},
99+
"foo:bar/[email protected]": {
100+
"path": "path/to/component.wasm",
101+
"export": null
102+
},
103+
"fib:fub/fob": {
104+
"path": "path/to/component.wasm",
105+
"export": "my-export"
106+
},
107+
"fizz:buzz": ">=0.1.0",
108+
109+
"version": "=0.1.0",
110+
"registry": null,
111+
"package": null,
112+
"export": null
115113
}
116114
}
117115
}

0 commit comments

Comments
 (0)