nvd_cwe/
views.rs

1//! A view represents a perspective with which one might look at the weaknesses in the catalog.
2//! There are three different types of views as defined by the type attribute: graphs,
3//! explicit slices, and implicit slices. The members of a view are either defined externally
4//! through the members element (in the case of a graph or an explicit slice) or by the optional
5//! filter element (in the case of an implicit slice).
6//!
7//! The required Objective element describes the perspective from which the view has been constructed.
8//! The optional Audience element provides a reference to the target stakeholders or groups for
9//! whom the view is most relevant. The optional Members element is used to define Member_Of
10//! relationships with categories. The optional Filter element is only used for implicit slices
11//! (see the Type attribute) and holds an XSL query for identifying which entries are members of
12//! the view. The optional References element is used to provide further reading and insight into
13//! this view. This element should be used when the view is based on external sources or projects.
14//! The optional Notes element is used to provide any additional comments that cannot be captured
15//! using the other elements of the view. The optional Content_History element is used to keep track
16//! of the original author of the view and any subsequent modifications to the content.
17//! This provides a means of contacting the authors and modifiers for clarifying ambiguities,
18//! or in merging overlapping contributions.
19//!
20//! The required ID attribute provides a unique identifier for the view. It is meant to be static
21//! for the lifetime of the view. If the view becomes deprecated, the ID should not be reused,
22//! and a placeholder for the deprecated view should be left in the catalog. The required Name
23//! attribute provides a descriptive title used to give the reader an idea of what perspective this
24//! view represents. All words in the name should be capitalized except for articles and prepositions,
25//! unless they begin or end the name. The required Type attribute describes how this view is being
26//! constructed. Please refer to the ViewTypeEnumeration simple type for a list of valid values and
27//! their meanings. The required Status attribute defines the maturity of the information for this
28//! view. Please refer to the StatusEnumeration simple type for a list of valid values and their meanings.
29//!
30use crate::content_history::ContentHistory;
31use crate::mapping_notes::MappingNotes;
32use crate::notes::Notes;
33use crate::relationships::Relationships;
34use crate::structured_text::StructuredText;
35use crate::weaknesses::References;
36use serde::{Deserialize, Serialize};
37
38#[derive(Debug, Deserialize, Serialize)]
39#[serde(deny_unknown_fields)]
40pub struct Views {
41  #[serde(rename(deserialize = "$value"), default)]
42  pub views: Vec<View>,
43}
44
45#[derive(Debug, Deserialize, Serialize)]
46#[serde(deny_unknown_fields)]
47pub struct View {
48  #[serde(rename(deserialize = "@ID"))]
49  pub id: i64,
50  #[serde(rename(deserialize = "@Name"))]
51  pub name: String,
52  #[serde(rename(deserialize = "@Type"))]
53  pub r#type: String,
54  #[serde(rename(deserialize = "@Status"))]
55  pub status: String,
56  #[serde(rename(deserialize = "References"))]
57  pub references: Option<References>,
58  #[serde(rename(deserialize = "Objective"))]
59  pub objective: StructuredText,
60  #[serde(rename(deserialize = "Audience"))]
61  pub audience: Option<Audience>,
62  #[serde(rename(deserialize = "Members"))]
63  pub members: Option<Relationships>,
64  #[serde(rename(deserialize = "Notes"))]
65  pub notes: Option<Notes>,
66  #[serde(rename(deserialize = "Filter"))]
67  pub filter: Option<String>,
68  #[serde(rename(deserialize = "Content_History"))]
69  pub content_history: ContentHistory,
70  #[serde(rename(deserialize = "Mapping_Notes"))]
71  pub mapping_notes: MappingNotes,
72}
73
74#[derive(Debug, Deserialize, Serialize)]
75#[serde(deny_unknown_fields)]
76pub struct Audience {
77  #[serde(rename(deserialize = "$value"), default)]
78  pub stake_holders: Vec<StakeHolder>,
79}
80
81#[derive(Debug, Deserialize, Serialize)]
82#[serde(deny_unknown_fields)]
83pub struct StakeHolder {
84  #[serde(rename(deserialize = "Type"))]
85  pub r#type: String,
86  #[serde(rename(deserialize = "Description"))]
87  pub description: Option<String>,
88}