openapi_github/models/
vulnerability.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Vulnerability : A vulnerability describing the product and its affected versions within a GitHub Security Advisory.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Vulnerability {
17    #[serde(rename = "package", deserialize_with = "Option::deserialize")]
18    pub package: Option<Box<models::VulnerabilityPackage>>,
19    /// The range of the package versions affected by the vulnerability.
20    #[serde(rename = "vulnerable_version_range", deserialize_with = "Option::deserialize")]
21    pub vulnerable_version_range: Option<String>,
22    /// The package version that resolves the vulnerability.
23    #[serde(rename = "first_patched_version", deserialize_with = "Option::deserialize")]
24    pub first_patched_version: Option<String>,
25    /// The functions in the package that are affected by the vulnerability.
26    #[serde(rename = "vulnerable_functions", deserialize_with = "Option::deserialize")]
27    pub vulnerable_functions: Option<Vec<String>>,
28}
29
30impl Vulnerability {
31    /// A vulnerability describing the product and its affected versions within a GitHub Security Advisory.
32    pub fn new(package: Option<models::VulnerabilityPackage>, vulnerable_version_range: Option<String>, first_patched_version: Option<String>, vulnerable_functions: Option<Vec<String>>) -> Vulnerability {
33        Vulnerability {
34            package: package.map(Box::new),
35            vulnerable_version_range,
36            first_patched_version,
37            vulnerable_functions,
38        }
39    }
40}
41