Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Implement helper methods to reduce looping and struct accessor unwieldiness #33

Open
anweiss opened this issue Jan 8, 2019 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@anweiss
Copy link
Contributor

anweiss commented Jan 8, 2019

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.

@anweiss anweiss added the enhancement New feature or request label Jan 8, 2019
@asadullah-yousuf-10p
Copy link
Contributor

@anweiss we are mostly using these structs in code generators for now. I was looking for some use-cases where you feel these helper methods are required. This will help us create effective helper methods that will actually be used.

@anweiss
Copy link
Contributor Author

anweiss commented Jan 10, 2019

@asadullah-yousuf-10p the use cases I have in mind are geared towards developers that are working directly with the OSCAL structs but that don't have an already formatted OSCAL artifact that they are parsing. So for instance, if I'm building a tool to convert a generic document into OSCAL format, I'd like to be able to use the OSCAL structs provided by oscalkit. And in that case, helper methods such as the one above would be advantageous.

@anweiss anweiss added this to the future milestone Jan 20, 2019
@minhaj10p
Copy link
Contributor

@anweiss
Let me know your thoughts on this approach #82

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants