When creating OSCAL structs from various data sources, there can often be a number of unwieldy looping and struct accessor lines. Even creating a simple control with a single string narrative requires an unnecessary number of lines of code. Instead, we should provide helper methods that make it easy to go from simple strings to various OSCAL components (e.g. Parts, Prose, etc). So for example:
func NewPart(narrative string) catalog.Part {
return catalog.Part{
Prose: &catalog.Prose{
P: []catalog.P{
{Raw: narrative},
},
},
}
}
Helpers should be created for reading nested information as well so as to avoid unwieldy iteration constructs.
When creating OSCAL structs from various data sources, there can often be a number of unwieldy looping and struct accessor lines. Even creating a simple control with a single string narrative requires an unnecessary number of lines of code. Instead, we should provide helper methods that make it easy to go from simple strings to various OSCAL components (e.g.
Parts,Prose, etc). So for example:Helpers should be created for reading nested information as well so as to avoid unwieldy iteration constructs.