Skip to content

Commit

Permalink
Merge pull request #1 from JosiahOne/main
Browse files Browse the repository at this point in the history
Allow all data structures to be serde serialized
  • Loading branch information
gcmurphy authored Jun 20, 2022
2 parents acb2b39 + 1fbc07e commit 6bf235b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub enum Ecosystem {

/// Type of the affected range supplied. This can be an ecosystem
/// specific value, semver, or a git commit hash.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum RangeType {
/// Default for the case where a range type is omitted.
Expand All @@ -117,7 +117,7 @@ pub enum RangeType {

/// The event captures information about the how and when
/// the package was affected by the vulnerability.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum Event {
Expand All @@ -134,7 +134,7 @@ pub enum Event {

/// The range of versions of a package for which
/// it is affected by the vulnerability.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Range {
/// The format that the range events are specified in, for
/// example SEMVER or GIT.
Expand All @@ -155,7 +155,7 @@ pub struct Range {
/// by a particular vulnerability. The affected ranges can include
/// when the vulnerability was first introduced and also when it
/// was fixed.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Affected {
/// The package that is affected by the vulnerability
pub package: Package,
Expand Down Expand Up @@ -183,7 +183,7 @@ pub struct Affected {
/// The type of reference information that has been provided. Examples include
/// links to the original report, external advisories, or information about the
/// fix.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum ReferenceType {
#[serde(rename = "NONE")]
Expand All @@ -197,7 +197,7 @@ pub enum ReferenceType {
}

/// Reference to additional information about the vulnerability.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Reference {
/// The type of reference this URL points to.
#[serde(rename = "type")]
Expand All @@ -210,7 +210,7 @@ pub struct Reference {

/// The [`SeverityType`](SeverityType) describes the quantitative scoring method used to rate the
/// severity of the vulnerability.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub enum SeverityType {
/// The severity score was arrived at by using an unspecified
/// scoring method.
Expand All @@ -226,7 +226,7 @@ pub enum SeverityType {

/// The type and score used to describe the severity of a vulnerability using one
/// or more quantitative scoring methods.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Severity {
/// The severity type property must be a [`SeverityType`](SeverityType), which describes the
/// quantitative method used to calculate the associated score.
Expand All @@ -240,7 +240,7 @@ pub struct Severity {

/// Provides a way to give credit for the discovery, confirmation, patch or other events in the
/// life cycle of a vulnerability.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Credit {
pub name: String,
pub contact: Vec<String>,
Expand All @@ -252,7 +252,7 @@ pub struct Credit {
/// This is the entity that is returned when vulnerable data exists for
/// a given package or when requesting information about a specific vulnerability
/// by unique identifier.
#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Vulnerability {
/// The schema_version field is used to indicate which version of the OSV schema a particular
/// vulnerability was exported with.
Expand Down Expand Up @@ -333,7 +333,7 @@ pub enum Request {
PackageQuery { version: Version, package: Package },
}

#[derive(Debug, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
enum Response {
Vulnerabilities { vulns: Vec<Vulnerability> },
Expand Down

0 comments on commit 6bf235b

Please sign in to comment.