-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add 6.3.8 required fields #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
656736c
feat: add 6.3.8 required fields
peinjoh 61a6f0c
style: fmt
peinjoh 7b52988
fix: simplify
peinjoh 2767e0b
Merge branch 'main' into feat/add-6-3-8-required-fields
peinjoh b95b5cc
fix: refactor to use new macros
peinjoh bf9255a
style: cargo fmt
peinjoh f982368
Merge branch 'main' into feat/add-6-3-8-required-fields
peinjoh 05dbb11
fix: merge issues
peinjoh 358f867
fix: cr comment
peinjoh 88a38aa
style: fmt
peinjoh 90675ee
Merge branch 'main' into feat/add-6-3-8-required-fields
peinjoh 504b655
Merge branch 'main' into feat/add-6-3-8-required-fields
peinjoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
csaf-rs/src/csaf/traits/document/aggregate_severity_trait.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| use crate::csaf::traits::util::impl_macros::{impl_optional_str_field_getter, impl_str_field_getter}; | ||
| use crate::schema::csaf2_0::schema::AggregateSeverity as AggregateSeverity20; | ||
| use crate::schema::csaf2_1::schema::AggregateSeverity as AggregateSeverity21; | ||
|
|
||
| pub trait AggregateSeverityTrait { | ||
| fn get_namespace(&self) -> Option<&str>; | ||
| fn get_text(&self) -> &str; | ||
| } | ||
|
|
||
| impl AggregateSeverityTrait for AggregateSeverity20 { | ||
| impl_optional_str_field_getter!(get_namespace, namespace); | ||
| impl_str_field_getter!(get_text, text); | ||
| } | ||
|
|
||
| impl AggregateSeverityTrait for AggregateSeverity21 { | ||
| impl_optional_str_field_getter!(get_namespace, namespace); | ||
| impl_str_field_getter!(get_text, text); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| use crate::csaf::traits::util::{impl_optional_str_field_getter, impl_str_field_getter}; | ||
| use crate::schema::csaf2_0::schema::EngineOfDocumentGeneration as Engine20; | ||
| use crate::schema::csaf2_1::schema::EngineOfDocumentGeneration as Engine21; | ||
|
|
||
| /// Trait for accessing document generation engine information | ||
| pub trait EngineTrait { | ||
| fn get_name(&self) -> &str; | ||
| fn get_version(&self) -> Option<&str>; | ||
| } | ||
|
|
||
| impl EngineTrait for Engine20 { | ||
| impl_str_field_getter!(get_name, name); | ||
| impl_optional_str_field_getter!(get_version, version); | ||
| } | ||
|
|
||
| impl EngineTrait for Engine21 { | ||
| impl_str_field_getter!(get_name, name); | ||
| impl_optional_str_field_getter!(get_version, version); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,36 @@ | ||
| use crate::csaf::traits::document::engine_trait::EngineTrait; | ||
| use crate::csaf_traits::WithOptionalDate; | ||
| use crate::schema::csaf2_0::schema::DocumentGenerator as DocumentGenerator20; | ||
| use crate::schema::csaf2_1::schema::DocumentGenerator as DocumentGenerator21; | ||
| use crate::schema::csaf2_0::schema::{ | ||
| DocumentGenerator as DocumentGenerator20, EngineOfDocumentGeneration as Engine20, | ||
| }; | ||
| use crate::schema::csaf2_1::schema::{ | ||
| DocumentGenerator as DocumentGenerator21, EngineOfDocumentGeneration as Engine21, | ||
| }; | ||
|
|
||
| /// Trait for accessing document generator information | ||
| pub trait GeneratorTrait: WithOptionalDate {} | ||
| pub trait GeneratorTrait: WithOptionalDate { | ||
| /// Type representing the generation engine | ||
| type EngineType: EngineTrait; | ||
|
|
||
| impl GeneratorTrait for DocumentGenerator20 {} | ||
| /// Returns the engine that generated this document | ||
| fn get_engine(&self) -> &Self::EngineType; | ||
| } | ||
|
|
||
| impl GeneratorTrait for DocumentGenerator21 {} | ||
| impl GeneratorTrait for DocumentGenerator20 { | ||
| type EngineType = Engine20; | ||
|
|
||
| fn get_engine(&self) -> &Self::EngineType { | ||
| &self.engine | ||
| } | ||
| } | ||
|
|
||
| impl GeneratorTrait for DocumentGenerator21 { | ||
| type EngineType = Engine21; | ||
|
|
||
| fn get_engine(&self) -> &Self::EngineType { | ||
| &self.engine | ||
| } | ||
| } | ||
|
|
||
| crate::csaf::traits::impl_with_optional_date!(DocumentGenerator20); | ||
| crate::csaf::traits::impl_with_optional_date!(DocumentGenerator21); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| use crate::csaf::traits::util::impl_optional_str_field_getter; | ||
| use crate::schema::csaf2_0::schema::Acknowledgment as Acknowledgment20; | ||
| use crate::schema::csaf2_1::schema::Acknowledgment as Acknowledgment21; | ||
|
|
||
| pub trait AcknowledgmentTrait { | ||
| fn get_names(&self) -> Vec<&str>; | ||
|
|
||
| fn get_organization(&self) -> Option<&str>; | ||
|
|
||
| fn get_summary(&self) -> Option<&str>; | ||
|
|
||
| fn get_urls(&self) -> Vec<&str>; | ||
| } | ||
|
|
||
| impl AcknowledgmentTrait for Acknowledgment20 { | ||
| fn get_names(&self) -> Vec<&str> { | ||
| self.names.iter().map(|n| n.as_str()).collect() | ||
| } | ||
|
|
||
| impl_optional_str_field_getter!(get_organization, organization); | ||
| impl_optional_str_field_getter!(get_summary, summary); | ||
|
|
||
| fn get_urls(&self) -> Vec<&str> { | ||
| self.urls.iter().map(|u| u.as_str()).collect() | ||
| } | ||
| } | ||
|
|
||
| impl AcknowledgmentTrait for Acknowledgment21 { | ||
| fn get_names(&self) -> Vec<&str> { | ||
| self.names.iter().map(|n| n.as_str()).collect() | ||
| } | ||
|
|
||
| impl_optional_str_field_getter!(get_organization, organization); | ||
| impl_optional_str_field_getter!(get_summary, summary); | ||
|
|
||
| fn get_urls(&self) -> Vec<&str> { | ||
| self.urls.iter().map(|u| u.as_str()).collect() | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| pub mod acknowledgment_trait; | ||
| pub mod note_trait; | ||
| pub mod references_trait; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.