phylum-dev / phylum-types

Public shared types for the phylum api and cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DistributionManagement site field uses incorrect type

ejortega opened this issue · comments

effective-pom files containing a "site" section are failing when parsed via the CLI.

      <site>
        <id>apache.website</id>
        <url>scm:svn:https://svn.apache.org/repos/asf/maven/website/components/ref/3-LATEST</url>
      </site>

Attempting to analyze the file leads to the following error.

❯ phs analyze effective-pom.xml          
[2022-07-13T21:52:13Z ERROR phylum] Execution failed: Unable to locate any valid package in package lockfile
    
    Caused by:
        Expected token XmlEvent::Characters(s), found StartElement({http://maven.apache.org/POM/4.0.0}id, {"": "http://maven.apache.org/POM/4.0.0", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/", "xsi": "http://www.w3.org/2001/XMLSchema-instance"})
❗ Error: Execution failed caused by: Unable to locate any valid package in package lockfile

The type for pub site: Option<String>, is incorrect. Example can be found https://maven.apache.org/ref/3.8.4/maven-model/maven.html

<[site](https://maven.apache.org/ref/3.8.4/maven-model/maven.html#class_site) child.site.url.inherit.append.path=.. >
      <id/>
      <name/>
      <url/>
</site>
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct DistributionManagement {
    pub repository: Option<Repository>,
    #[serde(rename = "snapshotRepository")]
    pub snapshot_repository: Option<Repository>,
    pub site: Option<String>,
    #[serde(rename = "downloadUrl")]
    pub download_url: Option<String>,
    pub relocation: Option<Relocation>,
    pub status: Option<String>,
}

Example file
effective-pom.xml.zip