Repository: bytecodealliance/wasm-tools
Pull request #1941 (2024-12-06 22:39:29)

[metadata] remove support for `registry` custom section
This PR removes the oudated `registry` custom section which is encoded as a JSON blob in a custom section. This is superseded by dedicated custom sections that can be  directly encoded as OCI Annotations, per #1922 and https://github.com/WebAssembly/tool-conventions/issues/230. Thanks!

FYI @bytecodealliance/sig-packaging 


Patch:
diff --git a/crates/wasm-metadata/src/add_metadata.rs b/crates/wasm-metadata/src/add_metadata.rs
index cc961d90..c30e273d 100644
--- a/crates/wasm-metadata/src/add_metadata.rs
+++ b/crates/wasm-metadata/src/add_metadata.rs
@@ -1,4 +1,4 @@
-use crate::{rewrite_wasm, Author, Description, Licenses, Producers, RegistryMetadata, Source};
+use crate::{rewrite_wasm, Author, Description, Licenses, Producers, Source};
 
 use anyhow::Result;
 
@@ -41,10 +41,6 @@ pub struct AddMetadata {
     /// URL to get source code for building the image
     #[cfg_attr(feature = "clap", clap(long, value_name = "NAME"))]
     pub source: Option<Source>,
-
-    /// Add an registry metadata to the registry-metadata section
-    #[cfg_attr(feature="clap", clap(long, value_parser = parse_registry_metadata_value, value_name="PATH"))]
-    pub registry_metadata: Option<RegistryMetadata>,
 }
 
 #[cfg(feature = "clap")]
@@ -54,15 +50,6 @@ pub(crate) fn parse_key_value(s: &str) -> Result<(String, String)> {
         .ok_or_else(|| anyhow::anyhow!("expected KEY=VALUE"))
 }
 
-#[cfg(feature = "clap")]
-pub(crate) fn parse_registry_metadata_value(s: &str) -> Result<RegistryMetadata> {
-    let contents = std::fs::read(s)?;
-
-    let registry_metadata = RegistryMetadata::from_bytes(&contents, 0)?;
-
-    Ok(registry_metadata)
-}
-
 impl AddMetadata {
     /// Process a WebAssembly binary. Supports both core WebAssembly modules, and WebAssembly
     /// components. The module and component will have, at very least, an empty name and producers
@@ -75,7 +62,6 @@ impl AddMetadata {
             &self.description,
             &self.licenses,
             &self.source,
-            self.registry_metadata.as_ref(),
             input,
         )
     }
diff --git a/crates/wasm-metadata/src/lib.rs b/crates/wasm-metadata/src/lib.rs
index 2988707e..8b08229d 100644
--- a/crates/wasm-metadata/src/lib.rs
+++ b/crates/wasm-metadata/src/lib.rs
@@ -7,7 +7,6 @@ pub use metadata::Metadata;
 pub use names::{ComponentNames, ModuleNames};
 pub use oci_annotations::{Author, Description, Licenses, Source};
 pub use producers::{Producers, ProducersField};
-pub use registry::{CustomLicense, Link, LinkType, RegistryMetadata};
 
 pub(crate) use rewrite::rewrite_wasm;
 
@@ -16,7 +15,6 @@ mod metadata;
 mod names;
 mod oci_annotations;
 mod producers;
-mod registry;
 mod rewrite;
 
 pub(crate) mod utils;
diff --git a/crates/wasm-metadata/src/metadata.rs b/crates/wasm-metadata/src/metadata.rs
index f9ab6e60..e9dc3163 100644
--- a/crates/wasm-metadata/src/metadata.rs
+++ b/crates/wasm-metadata/src/metadata.rs
@@ -4,9 +4,7 @@ use std::fmt;
 use std::ops::Range;
 use wasmparser::{KnownCustom, Parser, Payload::*};
 
-use crate::{
-    Author, ComponentNames, Description, Licenses, ModuleNames, Producers, RegistryMetadata, Source,
-};
+use crate::{Author, ComponentNames, Description, Licenses, ModuleNames, Producers, Source};
 
 /// A tree of the metadata found in a WebAssembly binary.
 #[derive(Debug, Serialize)]
@@ -18,8 +16,6 @@ pub enum Metadata {
         name: Option<String>,
         /// The component's producers section, if any.
         producers: Option<Producers>,
-        /// The component's registry metadata section, if any.
-        registry_metadata: Option<RegistryMetadata>,
         /// The component's author section, if any.
         author: Option<Author>,
         /// Human-readable description of the binary
@@ -39,8 +35,6 @@ pub enum Metadata {
         name: Option<String>,
         /// The module's producers section, if any.
         producers: Option<Producers>,
-        /// The module's registry metadata section, if any.
-        registry_metadata: Option<RegistryMetadata>,
         /// The component's author section, if any.
         author: Option<Author>,
         /// Human-readable description of the binary
@@ -116,14 +110,6 @@ impl Metadata {
                             .expect("non-empty metadata stack")
                             .set_producers(producers);
                     }
-                    KnownCustom::Unknown if c.name() == "registry-metadata" => {
-                        let registry: RegistryMetadata =
-                            RegistryMetadata::from_bytes(&c.data(), 0)?;
-                        metadata
-                            .last_mut()
-                            .expect("non-empty metadata stack")
-                            .set_registry_metadata(registry);
-                    }
                     KnownCustom::Unknown if c.name() == "author" => {
                         let a = Author::parse_custom_section(&c)?;
                         match metadata.last_mut().expect("non-empty metadata stack") {
@@ -170,7 +156,6 @@ impl Metadata {
             description: None,
             licenses: None,
             source: None,
-            registry_metadata: None,
             children: Vec::new(),
             range,
         }
@@ -184,7 +169,6 @@ impl Metadata {
             description: None,
             licenses: None,
             source: None,
-            registry_metadata: None,
             range,
         }
     }
@@ -200,16 +184,6 @@ impl Metadata {
             Metadata::Component { producers, .. } => *producers = Some(p),
         }
     }
-    fn set_registry_metadata(&mut self, r: RegistryMetadata) {
-        match self {
-            Metadata::Module {
-                registry_metadata, ..
-            } => *registry_metadata = Some(r),
-            Metadata::Component {
-                registry_metadata, ..
-            } => *registry_metadata = Some(r),
-        }
-    }
     fn push_child(&mut self, child: Self) {
         match self {
             Metadata::Module { .. } => panic!("module shouldnt have children"),
@@ -221,10 +195,7 @@ impl Metadata {
         let spaces = std::iter::repeat(" ").take(indent).collect::<String>();
         match self {
             Metadata::Module {
-                name,
-                producers,
-                registry_metadata,
-                ..
+                name, producers, ..
             } => {
                 if let Some(name) = name {
                     writeln!(f, "{spaces}module {name}:")?;
@@ -234,15 +205,11 @@ impl Metadata {
                 if let Some(producers) = producers {
                     producers.display(f, indent + 4)?;
                 }
-                if let Some(registry_metadata) = registry_metadata {
-                    registry_metadata.display(f, indent + 4)?;
-                }
                 Ok(())
             }
             Metadata::Component {
                 name,
                 producers,
-                registry_metadata,
                 children,
                 ..
             } => {
@@ -254,9 +221,6 @@ impl Metadata {
                 if let Some(producers) = producers {
                     producers.display(f, indent + 4)?;
                 }
-                if let Some(registry_metadata) = registry_metadata {
-                    registry_metadata.display(f, indent + 4)?;
-                }
                 for c in children {
                     c.display(f, indent + 4)?;
                 }
diff --git a/crates/wasm-metadata/src/producers.rs b/crates/wasm-metadata/src/producers.rs
index e3b4cde6..2e0124c9 100644
--- a/crates/wasm-metadata/src/producers.rs
+++ b/crates/wasm-metadata/src/producers.rs
@@ -148,7 +148,7 @@ impl Producers {
     /// Merge into an existing wasm module. Rewrites the module with this producers section
     /// merged into its existing one, or adds this producers section if none is present.
     pub fn add_to_wasm(&self, input: &[u8]) -> Result<Vec<u8>> {
-        rewrite_wasm(&None, self, &None, &None, &None, &None, None, input)
+        rewrite_wasm(&None, self, &None, &None, &None, &None, input)
     }
 
     pub(crate) fn display(&self, f: &mut fmt::Formatter, indent: usize) -> fmt::Result {
diff --git a/crates/wasm-metadata/src/registry.rs b/crates/wasm-metadata/src/registry.rs
deleted file mode 100644
index 286c61bc..00000000
--- a/crates/wasm-metadata/src/registry.rs
+++ /dev/null
@@ -1,400 +0,0 @@
-use anyhow::Result;
-use serde_derive::{Deserialize, Serialize};
-use spdx::Expression;
-use std::fmt;
-use std::fmt::Display;
-use wasmparser::Parser;
-
-use crate::{rewrite_wasm, Producers};
-
-/// Metadata used by a Warg registry
-#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq)]
-pub struct RegistryMetadata {
-    /// List of authors who has created this package.
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub authors: Option<Vec<String>>,
-
-    /// Package description in markdown format.
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub description: Option<String>,
-
-    /// SPDX License Expression
-    /// <https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/>
-    /// SPDX License List: <https://spdx.org/licenses/>
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub license: Option<String>,
-
-    /// A list of custom licenses that should be referenced to from the license expression.
-    /// <https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/>
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub custom_licenses: Option<Vec<CustomLicense>>,
-
-    /// A list of links that can contain predefined link types or custom links for use with tooling or registries.
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub links: Option<Vec<Link>>,
-
-    /// A list of categories that a package should be listed under when uploaded to a registry.
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub categories: Option<Vec<String>>,
-}
-
-const LICENSE_REF: &str = "LicenseRef-";
-
-impl RegistryMetadata {
-    /// Merge into an existing wasm module. Rewrites the module with this registry-metadata section
-    /// overwriting its existing one, or adds this registry-metadata section if none is present.
-    pub fn add_to_wasm(&self, input: &[u8]) -> Result<Vec<u8>> {
-        rewrite_wasm(
-            &None,
-            &Producers::empty(),
-            &None,
-            &None,
-            &None,
-            &None,
-            Some(&self),
-            input,
-        )
-    }
-
-    /// Parse a Wasm binary and extract the `Registry` section, if there is any.
-    pub fn from_wasm(bytes: &[u8]) -> Result<Option<Self>> {
-        let mut depth = 0;
-        for payload in Parser::new(0).parse_all(bytes) {
-            let payload = payload?;
-            use wasmparser::Payload::*;
-            match payload {
-                ModuleSection { .. } | ComponentSection { .. } => depth += 1,
-                End { .. } => depth -= 1,
-                CustomSection(c) if c.name() == "registry-metadata" && depth == 0 => {
-                    let registry = RegistryMetadata::from_bytes(&c.data(), 0)?;
-                    return Ok(Some(registry));
-                }
-                _ => {}
-            }
-        }
-        Ok(None)
-    }
-
-    /// Gets the registry-matadata from a slice of bytes
-    pub fn from_bytes(bytes: &[u8], offset: usize) -> Result<Self> {
-        let registry: RegistryMetadata = serde_json::from_slice(&bytes[offset..])?;
-        return Ok(registry);
-    }
-
-    /// Validate the `RegistryMetadata::license` an
-    /// `RegistryMetadata::CustomLicense` are valid SPDX expressions.
-    pub fn validate(&self) -> Result<()> {
-        fn validate_expression(expression: &str) -> Result<Vec<String>> {
-            let expression = Expression::parse(expression)?;
-
-            let mut licenses = Vec::new();
-
-            for license in expression.iter() {
-                match license {
-                    spdx::expression::ExprNode::Op(_) => continue,
-                    spdx::expression::ExprNode::Req(req) => {
-                        if let spdx::LicenseItem::Spdx { .. } = req.req.license {
-                            // Continue if it's a license that exists on the Spdx license list
-                            continue;
-                        }
-
-                        let license_id = req.req.to_string();
-
-                        // Strip "LicenseRef-", convert to lowercase and then append
-                        if let Some(id) = license_id.strip_prefix(LICENSE_REF) {
-                            licenses.push(id.to_lowercase());
-                        }
-                    }
-                }
-            }
-
-            Ok(licenses)
-        }
-
-        match (&self.license, &self.custom_licenses) {
-            (None, Some(custom_licenses)) => {
-                let ids = custom_licenses
-                    .iter()
-                    .map(|license| license.id.clone())
-                    .collect::<Vec<String>>()
-                    .join(", ");
-
-                return Err(anyhow::anyhow!(
-                    "{ids} are defined but nevered referenced in license expression"
-                ));
-            }
-            (Some(license), Some(custom_licenses)) => {
-                let licenses = validate_expression(license.as_str())?;
-
-                if !licenses.is_empty() {
-                    for license in &licenses {
-                        let mut match_found = false;
-                        for custom_license in custom_licenses {
-                            // Ignore license id casing
-                            if custom_license.id.to_lowercase() == *license {
-                                match_found = true;
-                            }
-                        }
-
-                        if !match_found {
-                            return Err(anyhow::anyhow!(
-                                "No matching reference for license '{license}' was defined"
-                            ));
-                        }
-                    }
-                }
-            }
-            (Some(license), None) => {
-                let licenses = validate_expression(license.as_str())?;
-
-                if !licenses.is_empty() {
-                    return Err(anyhow::anyhow!(
-                        "Reference to custom license exists but no custom license was given"
-                    ));
-                }
-            }
-            (None, None) => {}
-        }
-
-        Ok(())
-    }
-
-    /// Get authors
-    pub fn get_authors(&self) -> Option<&Vec<String>> {
-        self.authors.as_ref()
-    }
-
-    /// Set authors
-    pub fn set_authors(&mut self, authors: Option<Vec<String>>) {
-        self.authors = authors;
-    }
-
-    /// Get description
-    pub fn get_description(&self) -> Option<&String> {
-        self.description.as_ref()
-    }
-
-    /// Set description
-    pub fn set_description(&mut self, description: Option<String>) {
-        self.description = description;
-    }
-
-    /// Get license
-    pub fn get_license(&self) -> Option<&String> {
-        self.license.as_ref()
-    }
-
-    /// Set license
-    pub fn set_license(&mut self, license: Option<String>) {
-        self.license = license;
-    }
-
-    /// Get custom_licenses
-    pub fn get_custom_licenses(&self) -> Option<&Vec<CustomLicense>> {
-        self.custom_licenses.as_ref()
-    }
-
-    /// Set custom_licenses
-    pub fn set_custom_licenses(&mut self, custom_licenses: Option<Vec<CustomLicense>>) {
-        self.custom_licenses = custom_licenses;
-    }
-
-    /// Get links
-    pub fn get_links(&self) -> Option<&Vec<Link>> {
-        self.links.as_ref()
-    }
-
-    /// Set links
-    pub fn set_links(&mut self, links: Option<Vec<Link>>) {
-        self.links = links;
-    }
-
-    /// Get categories
-    pub fn get_categories(&self) -> Option<&Vec<String>> {
-        self.categories.as_ref()
-    }
-
-    /// Set categories
-    pub fn set_categories(&mut self, categories: Option<Vec<String>>) {
-        self.categories = categories;
-    }
-
-    pub(crate) fn display(&self, f: &mut fmt::Formatter, indent: usize) -> fmt::Result {
-        let spaces = std::iter::repeat(" ").take(indent).collect::<String>();
-
-        if let Some(authors) = &self.authors {
-            writeln!(f, "{spaces}authors:")?;
-            for author in authors {
-                writeln!(f, "{spaces}    {author}")?;
-            }
-        }
-
-        if let Some(license) = &self.license {
-            writeln!(f, "{spaces}license:")?;
-            writeln!(f, "{spaces}    {license}")?;
-        }
-
-        if let Some(links) = &self.links {
-            writeln!(f, "{spaces}links:")?;
-            for link in links {
-                writeln!(f, "{spaces}    {link}")?;
-            }
-        }
-
-        if let Some(categories) = &self.categories {
-            writeln!(f, "{spaces}categories:")?;
-            for category in categories {
-                writeln!(f, "{spaces}    {category}")?;
-            }
-        }
-
-        if let Some(description) = &self.description {
-            writeln!(f, "{spaces}description:")?;
-            writeln!(f, "{spaces}    {description}")?;
-        }
-
-        if let Some(custom_licenses) = &self.custom_licenses {
-            writeln!(f, "{spaces}custom_licenses:")?;
-            for license in custom_licenses {
-                license.display(f, indent + 4)?;
-            }
-        }
-
-        Ok(())
-    }
-}
-
-impl Display for RegistryMetadata {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.display(f, 0)
-    }
-}
-
-/// A link from the registry to an external website
-#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
-pub struct Link {
-    /// The type of link
-    pub ty: LinkType,
-    /// The address of the link
-    pub value: String,
-}
-
-impl Display for Link {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "{}: {}", self.ty, self.value)
-    }
-}
-
-/// What kind of link is this?
-#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
-pub enum LinkType {
-    /// Documentation
-    Documentation,
-    /// Homepage
-    Homepage,
-    /// Code repository
-    Repository,
-    /// Funding and donations
-    Funding,
-    /// Some other link type
-    #[serde(untagged)]
-    Custom(String),
-}
-
-impl Display for LinkType {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        let s = match self {
-            LinkType::Documentation => "Documentation",
-            LinkType::Homepage => "Homepage",
-            LinkType::Repository => "Repository",
-            LinkType::Funding => "Funding",
-            LinkType::Custom(s) => s.as_str(),
-        };
-
-        write!(f, "{s}")
-    }
-}
-
-/// A human readable short form license identifier for a license not on the SPDX
-/// License List.
-#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq)]
-pub struct CustomLicense {
-    /// License Identifier
-    /// Provides a locally unique identifier to refer to licenses that are not found on the SPDX License List.
-    /// <https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/#101-license-identifier-field>
-    pub id: String,
-
-    /// License Name
-    /// Provide a common name of the license that is not on the SPDX list.
-    /// <https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/#103-license-name-field>
-    pub name: String,
-
-    /// Extracted Text
-    /// Provides a copy of the actual text of the license reference extracted from the package or file that is associated with the License Identifier to aid in future analysis.
-    /// <https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/#102-extracted-text-field>
-    pub text: String,
-
-    /// License Cross Reference
-    /// Provides a pointer to the official source of a license that is not included in the SPDX License List, that is referenced by the License Identifier.
-    /// <https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/#104-license-cross-reference-field>
-    #[serde(skip_serializing_if = "Option::is_none")]
-    pub reference: Option<String>,
-}
-
-impl CustomLicense {
-    fn display(&self, f: &mut fmt::Formatter, indent: usize) -> fmt::Result {
-        let spaces = std::iter::repeat(" ").take(indent).collect::<String>();
-
-        writeln!(f, "{spaces}{}:", self.id)?;
-        writeln!(f, "{spaces}    name: {}", self.name)?;
-
-        if let Some(reference) = &self.reference {
-            writeln!(f, "{spaces}    reference: {reference}")?;
-        }
-
-        writeln!(f, "{spaces}    text:")?;
-        writeln!(f, "{spaces}        {}", self.text)?;
-
-        Ok(())
-    }
-}
-
-impl Display for CustomLicense {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.display(f, 0)
-    }
-}
-
-#[cfg(test)]
-mod test {
-    use super::*;
-    use crate::Metadata;
-    use wasm_encoder::Module;
-
-    #[test]
-    fn overwrite_registry_metadata() {
-        let module = Module::new().finish();
-        let registry_metadata = RegistryMetadata {
-            authors: Some(vec!["Foo".to_owned()]),
-            ..Default::default()
-        };
-        let module = registry_metadata.add_to_wasm(&module).unwrap();
-
-        let registry_metadata = RegistryMetadata {
-            authors: Some(vec!["Bar".to_owned()]),
-            ..Default::default()
-        };
-        let module = registry_metadata.add_to_wasm(&module).unwrap();
-
-        let metadata = Metadata::from_binary(&module).unwrap();
-        match metadata {
-            Metadata::Module {
-                registry_metadata, ..
-            } => {
-                let registry_metadata = registry_metadata.expect("some registry_metadata");
-                assert_eq!(registry_metadata.authors.unwrap(), vec!["Bar".to_owned()]);
-            }
-            _ => panic!("metadata should be module"),
-        }
-    }
-}
diff --git a/crates/wasm-metadata/src/rewrite.rs b/crates/wasm-metadata/src/rewrite.rs
index 44c10d50..43ea44f9 100644
--- a/crates/wasm-metadata/src/rewrite.rs
+++ b/crates/wasm-metadata/src/rewrite.rs
@@ -1,8 +1,5 @@
-use crate::{
-    Author, ComponentNames, Description, Licenses, ModuleNames, Producers, RegistryMetadata, Source,
-};
+use crate::{Author, ComponentNames, Description, Licenses, ModuleNames, Producers, Source};
 use anyhow::Result;
-use std::borrow::Cow;
 use std::mem;
 use wasm_encoder::ComponentSection as _;
 use wasm_encoder::{ComponentSectionId, Encode, Section};
@@ -15,7 +12,6 @@ pub(crate) fn rewrite_wasm(
     add_description: &Option<Description>,
     add_licenses: &Option<Licenses>,
     add_source: &Option<Source>,
-    add_registry_metadata: Option<&RegistryMetadata>,
     input: &[u8],
 ) -> Result<Vec<u8>> {
     let mut producers_found = false;
@@ -82,20 +78,6 @@ pub(crate) fn rewrite_wasm(
                         names.section()?.as_custom().append_to(&mut output);
                         continue;
                     }
-                    KnownCustom::Unknown if c.name() == "registry-metadata" => {
-                        // Pass section through if a new registry metadata isn't provided, otherwise ignore and overwrite with new
-                        if add_registry_metadata.is_none() {
-                            let registry: RegistryMetadata =
-                                RegistryMetadata::from_bytes(&c.data(), 0)?;
-
-                            let registry_metadata = wasm_encoder::CustomSection {
-                                name: Cow::Borrowed("registry-metadata"),
-                                data: Cow::Owned(serde_json::to_vec(&registry)?),
-                            };
-                            registry_metadata.append_to(&mut output);
-                            continue;
-                        }
-                    }
                     KnownCustom::Unknown if c.name() == "author" => {
                         if add_author.is_none() {
                             let author = Author::parse_custom_section(c)?;
@@ -165,12 +147,5 @@ pub(crate) fn rewrite_wasm(
     if let Some(source) = add_source {
         source.append_to(&mut output);
     }
-    if add_registry_metadata.is_some() {
-        let registry_metadata = wasm_encoder::CustomSection {
-            name: Cow::Borrowed("registry-metadata"),
-            data: Cow::Owned(serde_json::to_vec(&add_registry_metadata)?),
-        };
-        registry_metadata.append_to(&mut output);
-    }
     Ok(output)
 }


Test patch:
diff --git a/crates/wasm-metadata/tests/component.rs b/crates/wasm-metadata/tests/component.rs
index fdb930fa..61ed32c6 100644
--- a/crates/wasm-metadata/tests/component.rs
+++ b/crates/wasm-metadata/tests/component.rs
@@ -17,28 +17,6 @@ fn add_to_empty_component() {
             Licenses::new("Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT").unwrap(),
         ),
         source: Some(Source::new("https://github.com/bytecodealliance/wasm-tools").unwrap()),
-        registry_metadata: Some(RegistryMetadata {
-            authors: Some(vec!["foo".to_owned()]),
-            description: Some("foo bar baz".to_owned()),
-            license: Some("MIT OR LicenseRef-FOO".to_owned()),
-            custom_licenses: Some(vec![CustomLicense {
-                id: "FOO".to_owned(),
-                name: "Foo".to_owned(),
-                text: "Foo License".to_owned(),
-                reference: Some("https://exaple.com/license/foo".to_owned()),
-            }]),
-            links: Some(vec![
-                Link {
-                    ty: LinkType::Custom("CustomFoo".to_owned()),
-                    value: "https://example.com/custom".to_owned(),
-                },
-                Link {
-                    ty: LinkType::Homepage,
-                    value: "https://example.com".to_owned(),
-                },
-            ]),
-            categories: Some(vec!["Tools".to_owned()]),
-        }),
     };
     let component = add.to_wasm(&component).unwrap();
 
@@ -47,7 +25,6 @@ fn add_to_empty_component() {
         Metadata::Component {
             name,
             producers,
-            registry_metadata,
             author,
             description,
             licenses,
@@ -78,49 +55,8 @@ fn add_to_empty_component() {
                 Source::new("https://github.com/bytecodealliance/wasm-tools").unwrap(),
             );
 
-            let registry_metadata = registry_metadata.unwrap();
-
-            assert!(registry_metadata.validate().is_ok());
-
-            assert_eq!(registry_metadata.authors.unwrap(), vec!["foo".to_owned()]);
-            assert_eq!(
-                registry_metadata.description.unwrap(),
-                "foo bar baz".to_owned()
-            );
-
-            assert_eq!(
-                registry_metadata.license.unwrap(),
-                "MIT OR LicenseRef-FOO".to_owned()
-            );
-            assert_eq!(
-                registry_metadata.custom_licenses.unwrap(),
-                vec![CustomLicense {
-                    id: "FOO".to_owned(),
-                    name: "Foo".to_owned(),
-                    text: "Foo License".to_owned(),
-                    reference: Some("https://exaple.com/license/foo".to_owned()),
-                }]
-            );
-            assert_eq!(
-                registry_metadata.links.unwrap(),
-                vec![
-                    Link {
-                        ty: LinkType::Custom("CustomFoo".to_owned()),
-                        value: "https://example.com/custom".to_owned(),
-                    },
-                    Link {
-                        ty: LinkType::Homepage,
-                        value: "https://example.com".to_owned(),
-                    },
-                ]
-            );
-            assert_eq!(
-                registry_metadata.categories.unwrap(),
-                vec!["Tools".to_owned()]
-            );
-
             assert_eq!(range.start, 0);
-            assert_eq!(range.end, 602);
+            assert_eq!(range.end, 251);
         }
         _ => panic!("metadata should be component"),
     }
@@ -141,10 +77,6 @@ fn add_to_nested_component() {
             Licenses::new("Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT").unwrap(),
         ),
         source: Some(Source::new("https://github.com/bytecodealliance/wasm-tools").unwrap()),
-        registry_metadata: Some(RegistryMetadata {
-            authors: Some(vec!["Foo".to_owned()]),
-            ..Default::default()
-        }),
     };
     let module = add.to_wasm(&module).unwrap();
 
@@ -188,7 +120,6 @@ fn add_to_nested_component() {
                     producers,
                     author,
                     licenses,
-                    registry_metadata,
                     source,
                     range,
                     description,
@@ -220,14 +151,8 @@ fn add_to_nested_component() {
                         ),
                     );
 
-                    let registry_metadata = registry_metadata.as_ref().unwrap();
-                    assert_eq!(
-                        registry_metadata.authors.as_ref().unwrap(),
-                        &["Foo".to_owned()]
-                    );
-
                     assert_eq!(range.start, 11);
-                    assert_eq!(range.end, 291);
+                    assert_eq!(range.end, 252);
                 }
                 _ => panic!("child is a module"),
             }
diff --git a/crates/wasm-metadata/tests/module.rs b/crates/wasm-metadata/tests/module.rs
index 4a1bb9f7..1d5b46f4 100644
--- a/crates/wasm-metadata/tests/module.rs
+++ b/crates/wasm-metadata/tests/module.rs
@@ -17,28 +17,6 @@ fn add_to_empty_module() {
             Licenses::new("Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT").unwrap(),
         ),
         source: Some(Source::new("https://github.com/bytecodealliance/wasm-tools").unwrap()),
-        registry_metadata: Some(RegistryMetadata {
-            authors: Some(vec!["foo".to_owned()]),
-            description: Some("foo bar baz".to_owned()),
-            license: Some("MIT OR LicenseRef-FOO".to_owned()),
-            custom_licenses: Some(vec![CustomLicense {
-                id: "FOO".to_owned(),
-                name: "Foo".to_owned(),
-                text: "Foo License".to_owned(),
-                reference: Some("https://exaple.com/license/foo".to_owned()),
-            }]),
-            links: Some(vec![
-                Link {
-                    ty: LinkType::Custom("CustomFoo".to_owned()),
-                    value: "https://example.com/custom".to_owned(),
-                },
-                Link {
-                    ty: LinkType::Homepage,
-                    value: "https://example.com".to_owned(),
-                },
-            ]),
-            categories: Some(vec!["Tools".to_owned()]),
-        }),
     };
     let module = add.to_wasm(&module).unwrap();
 
@@ -51,7 +29,6 @@ fn add_to_empty_module() {
             description,
             licenses,
             source,
-            registry_metadata,
             range,
         } => {
             assert_eq!(name, Some("foo".to_owned()));
@@ -71,56 +48,13 @@ fn add_to_empty_module() {
                 licenses.unwrap(),
                 Licenses::new("Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT").unwrap()
             );
-
-            let registry_metadata = registry_metadata.unwrap();
-
-            assert!(registry_metadata.validate().is_ok());
-
-            assert_eq!(registry_metadata.authors.unwrap(), vec!["foo".to_owned()]);
-            assert_eq!(
-                registry_metadata.description.unwrap(),
-                "foo bar baz".to_owned()
-            );
-
-            assert_eq!(
-                registry_metadata.license.unwrap(),
-                "MIT OR LicenseRef-FOO".to_owned()
-            );
-
             assert_eq!(
                 source.unwrap(),
                 Source::new("https://github.com/bytecodealliance/wasm-tools").unwrap(),
             );
 
-            assert_eq!(
-                registry_metadata.custom_licenses.unwrap(),
-                vec![CustomLicense {
-                    id: "FOO".to_owned(),
-                    name: "Foo".to_owned(),
-                    text: "Foo License".to_owned(),
-                    reference: Some("https://exaple.com/license/foo".to_owned()),
-                }]
-            );
-            assert_eq!(
-                registry_metadata.links.unwrap(),
-                vec![
-                    Link {
-                        ty: LinkType::Custom("CustomFoo".to_owned()),
-                        value: "https://example.com/custom".to_owned(),
-                    },
-                    Link {
-                        ty: LinkType::Homepage,
-                        value: "https://example.com".to_owned(),
-                    },
-                ]
-            );
-            assert_eq!(
-                registry_metadata.categories.unwrap(),
-                vec!["Tools".to_owned()]
-            );
-
             assert_eq!(range.start, 0);
-            assert_eq!(range.end, 592);
+            assert_eq!(range.end, 241);
         }
         _ => panic!("metadata should be module"),
     }