From 50c7b66713a4cc979c6ea249b28fd429c0215e85 Mon Sep 17 00:00:00 2001 From: Jens Reimann Date: Fri, 20 Jun 2025 17:00:11 +0200 Subject: [PATCH] feat: have types implement Eq, PartialEq This helps in cases where you want to compare structs. Especially when testing. --- csaf-rs/build.rs | 9 ++- csaf-rs/src/csaf/csaf2_0/schema.rs | 76 ++++++++++---------- csaf-rs/src/csaf/csaf2_1/schema.rs | 84 +++++++++++----------- csaf-rs/src/csaf/csaf2_1/ssvc_dp_schema.rs | 6 +- csaf-rs/src/csaf/csaf2_1/ssvc_schema.rs | 6 +- 5 files changed, 93 insertions(+), 88 deletions(-) diff --git a/csaf-rs/build.rs b/csaf-rs/build.rs index 255e9cc..732fb06 100644 --- a/csaf-rs/build.rs +++ b/csaf-rs/build.rs @@ -57,7 +57,7 @@ fn main() -> Result<(), BuildError> { Ok(()) } -fn build(input: &str, output: &str, no_date_time: bool) -> Result<(), BuildError> { +fn build(input: &str, output: &str, no_date_time: bool) -> Result<(), BuildError> { let content = fs::read_to_string(&input)?; let mut schema_value = serde_json::from_str(&content)?; if no_date_time { @@ -66,7 +66,12 @@ fn build(input: &str, output: &str, no_date_time: bool) -> Result<(), BuildError } let schema: schemars::schema::RootSchema = serde_json::from_value(schema_value)?; - let mut type_space = TypeSpace::new(TypeSpaceSettings::default().with_struct_builder(true)); + let mut type_space = TypeSpace::new( + TypeSpaceSettings::default() + .with_struct_builder(true) + .with_derive("PartialEq".into()) + .with_derive("Eq".into()), + ); type_space.add_root_schema(schema)?; let content = prettyplease::unparse(&syn::parse2::(type_space.to_stream())?); diff --git a/csaf-rs/src/csaf/csaf2_0/schema.rs b/csaf-rs/src/csaf/csaf2_0/schema.rs index 6a95c14..99954ea 100644 --- a/csaf-rs/src/csaf/csaf2_0/schema.rs +++ b/csaf-rs/src/csaf/csaf2_0/schema.rs @@ -93,7 +93,7 @@ pub mod error { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Acknowledgment { ///Contains the names of contributors being recognized. #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] @@ -197,7 +197,7 @@ impl Acknowledgment { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct AcknowledgmentsT(pub ::std::vec::Vec); impl ::std::ops::Deref for AcknowledgmentsT { @@ -335,7 +335,7 @@ impl<'de> ::serde::Deserialize<'de> for AdditionalRestartInformation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct AggregateSeverity { ///Points to the namespace so referenced. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -675,7 +675,7 @@ impl<'de> ::serde::Deserialize<'de> for AudienceOfNote { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Branch { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub branches: ::std::option::Option, @@ -763,7 +763,7 @@ impl Branch { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct BranchesT(pub ::std::vec::Vec); impl ::std::ops::Deref for BranchesT { @@ -2427,7 +2427,7 @@ impl<'de> ::serde::Deserialize<'de> for CommonPlatformEnumerationRepresentation ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct CommonSecurityAdvisoryFramework { pub document: DocumentLevelMetaData, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -2685,7 +2685,7 @@ impl<'de> ::serde::Deserialize<'de> for ContributingOrganization { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct CryptographicHashes { ///Contains a list of cryptographic hashes for this file. pub file_hashes: ::std::vec::Vec, @@ -2900,7 +2900,7 @@ impl<'de> ::serde::Deserialize<'de> for Cve { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Cwe { ///Holds the ID for the weakness associated. pub id: WeaknessId, @@ -3224,7 +3224,7 @@ impl<'de> ::serde::Deserialize<'de> for DocumentCategory { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct DocumentGenerator { ///This SHOULD be the current date that the document was generated. Because documents are often generated internally by a document producer and exist for a nonzero amount of time before being released, this field MAY be different from the Initial Release Date and Current Release Date. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -3611,7 +3611,7 @@ impl DocumentGenerator { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct DocumentLevelMetaData { ///Contains a list of acknowledgment elements associated with the whole document. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -3862,7 +3862,7 @@ impl<'de> ::serde::Deserialize<'de> for EngineName { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct EngineOfDocumentGeneration { ///Represents the name of the engine that generated the CSAF document. pub name: EngineName, @@ -4087,7 +4087,7 @@ impl<'de> ::serde::Deserialize<'de> for EntitlementOfTheRemediation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct FileHash { ///Contains the name of the cryptographic hash algorithm used to calculate the value. pub algorithm: AlgorithmOfTheCryptographicHash, @@ -4228,7 +4228,7 @@ impl<'de> ::serde::Deserialize<'de> for Filename { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Flag { ///Contains the date when assessment was done or the flag was assigned. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -4454,7 +4454,7 @@ impl Flag { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct FullProductNameT { ///The value should be the product’s full canonical name, including version number and other attributes, as it would be used in a human-friendly document. pub name: TextualDescriptionOfTheProduct, @@ -4502,7 +4502,7 @@ impl FullProductNameT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct GenericUri { ///Refers to a URL which provides the name and knowledge about the specification used or is the namespace in which these values are valid. pub namespace: ::std::string::String, @@ -4699,7 +4699,7 @@ impl GenericUri { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct HelperToIdentifyTheProduct { ///The Common Platform Enumeration (CPE) attribute refers to a method for naming platforms external to this specification. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -4788,7 +4788,7 @@ impl HelperToIdentifyTheProduct { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Id { ///Indicates the name of the vulnerability tracking or numbering system. pub system_name: SystemName, @@ -4859,7 +4859,7 @@ impl Id { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Involvement { ///Holds the date and time of the involvement entry. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -5733,7 +5733,7 @@ impl<'de> ::serde::Deserialize<'de> for NameOfTheContributor { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Note { ///Indicates who is intended to read it. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -6011,7 +6011,7 @@ impl<'de> ::serde::Deserialize<'de> for NoteContent { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct NotesT(pub ::std::vec::Vec); impl ::std::ops::Deref for NotesT { @@ -6277,7 +6277,7 @@ impl ::std::convert::TryFrom<::std::string::String> for PartyStatus { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct ProductGroup { pub group_id: ProductGroupIdT, ///Lists the product_ids of those products which known as one group in the document. @@ -6397,7 +6397,7 @@ impl<'de> ::serde::Deserialize<'de> for ProductGroupIdT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct ProductGroupsT(pub Vec); impl ::std::ops::Deref for ProductGroupsT { @@ -6559,7 +6559,7 @@ impl<'de> ::serde::Deserialize<'de> for ProductIdT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct ProductStatus { ///These are the first versions of the releases known to be affected by the vulnerability. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -6721,7 +6721,7 @@ impl ProductStatus { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct ProductTree { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub branches: ::std::option::Option, @@ -6772,7 +6772,7 @@ impl ProductTree { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct ProductsT(pub Vec); impl ::std::ops::Deref for ProductsT { @@ -6864,7 +6864,7 @@ impl ::std::convert::From> for ProductsT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Publisher { ///Provides information about the category of publisher releasing the document. pub category: CategoryOfPublisher, @@ -6929,7 +6929,7 @@ impl Publisher { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Reference { ///Indicates whether the reference points to the same document or vulnerability in focus (depending on scope) or to an external resource. #[serde(default = "defaults::reference_category")] @@ -6995,7 +6995,7 @@ impl Reference { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct ReferencesT(pub ::std::vec::Vec); impl ::std::ops::Deref for ReferencesT { @@ -7064,7 +7064,7 @@ impl ::std::convert::From<::std::vec::Vec> for ReferencesT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Relationship { ///Defines the category of relationship for the referenced component. pub category: RelationshipCategory, @@ -7279,7 +7279,7 @@ impl ::std::convert::TryFrom<::std::string::String> for RelationshipCategory { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Remediation { ///Specifies the category which this remediation belongs to. pub category: CategoryOfTheRemediation, @@ -7350,7 +7350,7 @@ impl Remediation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct RestartRequiredByRemediation { ///Specifies what category of restart is required by this remediation to become effective. pub category: CategoryOfRestart, @@ -7411,7 +7411,7 @@ impl RestartRequiredByRemediation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Revision { ///The date of the revision entry pub date: ::std::string::String, @@ -7490,7 +7490,7 @@ impl Revision { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct RulesForSharingDocument { ///Provides a textual description of additional constraints. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -7543,7 +7543,7 @@ impl RulesForSharingDocument { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Score { #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] pub cvss_v2: ::serde_json::Map<::std::string::String, ::serde_json::Value>, @@ -8587,7 +8587,7 @@ impl<'de> ::serde::Deserialize<'de> for TextualDescriptionOfTheProduct { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Threat { ///Categorizes the threat according to the rules of the specification. pub category: CategoryOfTheThreat, @@ -9019,7 +9019,7 @@ impl<'de> ::serde::Deserialize<'de> for TitleOfThisDocument { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Tracking { ///Contains a list of alternate names for the same document. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -9087,7 +9087,7 @@ impl Tracking { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct TrafficLightProtocolTlp { ///Provides the TLP label of the document. pub label: LabelOfTlp, @@ -9808,7 +9808,7 @@ impl<'de> ::serde::Deserialize<'de> for VersionT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] pub struct Vulnerability { ///Contains a list of acknowledgment elements associated with this vulnerability item. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] diff --git a/csaf-rs/src/csaf/csaf2_1/schema.rs b/csaf-rs/src/csaf/csaf2_1/schema.rs index 0106d2b..a062bd1 100644 --- a/csaf-rs/src/csaf/csaf2_1/schema.rs +++ b/csaf-rs/src/csaf/csaf2_1/schema.rs @@ -94,7 +94,7 @@ pub mod error { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Acknowledgment { ///Contains the names of contributors being recognized. @@ -200,7 +200,7 @@ impl Acknowledgment { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct AcknowledgmentsT(pub ::std::vec::Vec); impl ::std::ops::Deref for AcknowledgmentsT { @@ -339,7 +339,7 @@ impl<'de> ::serde::Deserialize<'de> for AdditionalRestartInformation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct AggregateSeverity { ///Points to the namespace so referenced. @@ -682,7 +682,7 @@ impl<'de> ::serde::Deserialize<'de> for AudienceOfNote { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Branch { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -773,7 +773,7 @@ impl Branch { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct BranchesT(pub ::std::vec::Vec); impl ::std::ops::Deref for BranchesT { @@ -2668,7 +2668,7 @@ impl<'de> ::serde::Deserialize<'de> for CommonPlatformEnumerationRepresentation ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct CommonSecurityAdvisoryFramework { pub document: DocumentLevelMetaData, @@ -2832,7 +2832,7 @@ impl<'de> ::serde::Deserialize<'de> for ContactDetails { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Content { #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] @@ -3025,7 +3025,7 @@ impl<'de> ::serde::Deserialize<'de> for ContributingOrganization { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct CryptographicHashes { ///Contains a list of cryptographic hashes for this file. @@ -3257,7 +3257,7 @@ impl<'de> ::serde::Deserialize<'de> for Cve { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Cwe { ///Holds the ID for the weakness associated. @@ -3679,7 +3679,7 @@ impl<'de> ::serde::Deserialize<'de> for DocumentCategory { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct DocumentGenerator { ///This SHOULD be the current date that the document was generated. Because documents are often generated internally by a document producer and exist for a nonzero amount of time before being released, this field MAY be different from the Initial Release Date and Current Release Date. @@ -4125,7 +4125,7 @@ impl DocumentGenerator { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct DocumentLevelMetaData { ///Contains a list of acknowledgment elements associated with the whole document. @@ -4380,7 +4380,7 @@ impl<'de> ::serde::Deserialize<'de> for EngineName { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct EngineOfDocumentGeneration { ///Represents the name of the engine that generated the CSAF document. @@ -4599,7 +4599,7 @@ impl<'de> ::serde::Deserialize<'de> for EntitlementOfTheRemediation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Epss { ///Contains the rank ordering of probabilities from highest to lowest. @@ -4664,7 +4664,7 @@ impl Epss { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct FileHash { ///Contains the name of the cryptographic hash algorithm used to calculate the value. @@ -4802,7 +4802,7 @@ impl<'de> ::serde::Deserialize<'de> for Filename { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct FirstKnownExploitationDate { ///Contains the date when the information was last updated. @@ -4865,7 +4865,7 @@ impl FirstKnownExploitationDate { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Flag { ///Contains the date when assessment was done or the flag was assigned. @@ -5104,7 +5104,7 @@ impl Flag { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct FullProductNameT { ///The value should be the product’s full canonical name, including version number and other attributes, as it would be used in a human-friendly document. @@ -5154,7 +5154,7 @@ impl FullProductNameT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct GenericUri { ///Refers to a URL which provides the name and knowledge about the specification used or is the namespace in which these values are valid. @@ -5363,7 +5363,7 @@ impl GenericUri { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct HelperToIdentifyTheProduct { ///The Common Platform Enumeration (CPE) attribute refers to a method for naming platforms external to this specification. @@ -5454,7 +5454,7 @@ impl HelperToIdentifyTheProduct { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Id { ///Indicates the name of the vulnerability tracking or numbering system. @@ -5539,7 +5539,7 @@ impl Id { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Involvement { ///Contains the contact information of the party that was used in this state. @@ -6282,7 +6282,7 @@ impl<'de> ::serde::Deserialize<'de> for LicenseExpression { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Metric { pub content: Content, @@ -6705,7 +6705,7 @@ impl<'de> ::serde::Deserialize<'de> for NameOfTheContributor { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Note { ///Indicates who is intended to read it. @@ -6995,7 +6995,7 @@ impl<'de> ::serde::Deserialize<'de> for NoteContent { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct NotesT(pub ::std::vec::Vec); impl ::std::ops::Deref for NotesT { @@ -7511,7 +7511,7 @@ impl<'de> ::serde::Deserialize<'de> for Probability { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct ProductGroup { pub group_id: ProductGroupIdT, @@ -7632,7 +7632,7 @@ impl<'de> ::serde::Deserialize<'de> for ProductGroupIdT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct ProductGroupsT(pub Vec); impl ::std::ops::Deref for ProductGroupsT { @@ -7800,7 +7800,7 @@ impl<'de> ::serde::Deserialize<'de> for ProductIdT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct ProductStatus { ///These are the first versions of the releases known to be affected by the vulnerability. @@ -7970,7 +7970,7 @@ impl ProductStatus { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct ProductTree { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -8022,7 +8022,7 @@ impl ProductTree { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct ProductsT(pub Vec); impl ::std::ops::Deref for ProductsT { @@ -8116,7 +8116,7 @@ impl ::std::convert::From> for ProductsT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Publisher { ///Provides information about the category of publisher releasing the document. @@ -8183,7 +8183,7 @@ impl Publisher { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Reference { ///Indicates whether the reference points to the same document or vulnerability in focus (depending on scope) or to an external resource. @@ -8251,7 +8251,7 @@ impl Reference { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct ReferencesT(pub ::std::vec::Vec); impl ::std::ops::Deref for ReferencesT { @@ -8321,7 +8321,7 @@ impl ::std::convert::From<::std::vec::Vec> for ReferencesT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Relationship { ///Defines the category of relationship for the referenced component. @@ -8541,7 +8541,7 @@ impl ::std::convert::TryFrom<::std::string::String> for RelationshipCategory { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Remediation { ///Specifies the category which this remediation belongs to. @@ -8614,7 +8614,7 @@ impl Remediation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct RestartRequiredByRemediation { ///Specifies what category of restart is required by this remediation to become effective. @@ -8677,7 +8677,7 @@ impl RestartRequiredByRemediation { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Revision { ///The date of the revision entry @@ -8794,7 +8794,7 @@ impl Revision { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct RulesForSharingDocument { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] @@ -8931,7 +8931,7 @@ impl<'de> ::serde::Deserialize<'de> for SerialNumber { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct SharingGroup { ///Provides the unique ID for the sharing group. @@ -10073,7 +10073,7 @@ impl<'de> ::serde::Deserialize<'de> for TextualDescriptionOfTheProduct { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Threat { ///Categorizes the threat according to the rules of the specification. @@ -10510,7 +10510,7 @@ impl<'de> ::serde::Deserialize<'de> for TitleOfThisDocument { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Tracking { ///Contains a list of alternate names for the same document. @@ -10582,7 +10582,7 @@ impl Tracking { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct TrafficLightProtocolTlp { ///Provides the TLP label of the document. @@ -11443,7 +11443,7 @@ impl<'de> ::serde::Deserialize<'de> for VersionT { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct Vulnerability { ///Contains a list of acknowledgment elements associated with this vulnerability item. diff --git a/csaf-rs/src/csaf/csaf2_1/ssvc_dp_schema.rs b/csaf-rs/src/csaf/csaf2_1/ssvc_dp_schema.rs index 2fce551..b5f03e9 100644 --- a/csaf-rs/src/csaf/csaf2_1/ssvc_dp_schema.rs +++ b/csaf-rs/src/csaf/csaf2_1/ssvc_dp_schema.rs @@ -107,7 +107,7 @@ pub mod error { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct DecisionPoint { ///A full description of the Decision Point, explaining what it represents and how it is used in SSVC. @@ -481,7 +481,7 @@ impl<'de> ::serde::Deserialize<'de> for DecisionPointNamespace { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct DecisionPointSchemaDefinition(pub DecisionPoint); impl ::std::ops::Deref for DecisionPointSchemaDefinition { @@ -551,7 +551,7 @@ impl ::std::convert::From for DecisionPointSchemaDefinition { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct DecisionPointValue { ///A full description of the Decision Point Value. diff --git a/csaf-rs/src/csaf/csaf2_1/ssvc_schema.rs b/csaf-rs/src/csaf/csaf2_1/ssvc_schema.rs index 87cad8d..f409168 100644 --- a/csaf-rs/src/csaf/csaf2_1/ssvc_schema.rs +++ b/csaf-rs/src/csaf/csaf2_1/ssvc_schema.rs @@ -316,7 +316,7 @@ impl ::std::convert::TryFrom<::std::string::String> for SchemaVersion { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct SsvcV1 { pub id: Id, @@ -402,7 +402,7 @@ impl SsvcV1 { ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(deny_unknown_fields)] pub struct SsvcdecisionpointselectionSchema { ///A short label that identifies a Decision Point. @@ -713,7 +713,7 @@ impl<'de> ::serde::Deserialize<'de> for SsvcdecisionpointselectionSchemaVersion ///} /// ``` /// -#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] +#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, PartialEq)] #[serde(transparent)] pub struct Timestamp(pub chrono::DateTime); impl ::std::ops::Deref for Timestamp {