diff --git a/cli/cmd/info.go b/cli/cmd/info.go index 23bcb43..3a79091 100644 --- a/cli/cmd/info.go +++ b/cli/cmd/info.go @@ -1,8 +1,8 @@ package cmd import ( - "fmt" "errors" + "fmt" "github.com/gocomply/oscalkit/pkg/oscal/constants" "github.com/gocomply/oscalkit/pkg/oscal_source" @@ -84,7 +84,7 @@ func printMetadata(m *catalog.Metadata) { return } fmt.Println("Metadata:") - fmt.Println("\tTitle:\t\t\t", m.Title) + fmt.Println("\tTitle:\t\t\t", m.Title.Raw) if m.Published != "" { fmt.Println("\tPublished:\t\t", m.Published) } @@ -112,8 +112,8 @@ func printImports(p *profile.Profile) error { return fmt.Errorf("Could not resolve profile import %s", imp.Href) } - if resource.Title != "" { - fmt.Println("\tTitle:\t\t\t", resource.Title) + if resource.Title != nil { + fmt.Println("\tTitle:\t\t\t", resource.Title.Raw) } if resource.Desc != "" { fmt.Println("\tDesc:\t\t\t", resource.Desc) diff --git a/pkg/opencontrol/standard.go b/pkg/opencontrol/standard.go index 57b3d63..5653e7a 100644 --- a/pkg/opencontrol/standard.go +++ b/pkg/opencontrol/standard.go @@ -39,7 +39,7 @@ func NewStandard(catalog *catalog.Catalog) (*Standard, error) { } return &Standard{ - Name: string(catalog.Metadata.Title), + Name: string(catalog.Metadata.Title.Raw), Controls: controls, }, nil } @@ -56,7 +56,7 @@ func (std *Standard) SaveToFile(filename string) error { func (controls Controls) Add(ctrl *catalog.Control, family string) { controls[oscalIdToOpencontrol(ctrl.Id)] = Control{ Family: family, - Name: string(ctrl.Title), + Name: string(ctrl.Title.Raw), Description: ctrl.StatementToMarkdown(), } for _, child := range ctrl.Controls { diff --git a/types/oscal/catalog/helpers.go b/types/oscal/catalog/helpers.go index b1cd3aa..0a40c88 100644 --- a/types/oscal/catalog/helpers.go +++ b/types/oscal/catalog/helpers.go @@ -11,7 +11,7 @@ type ControlOpts struct { func NewPart(id, title, narrative string) Part { return Part{ Id: id, - Title: Title(title), + Title: &Title{Raw: title}, Prose: &Prose{Raw: narrative}, } } @@ -20,7 +20,7 @@ func NewPart(id, title, narrative string) Part { func NewControl(id, title string, opts *ControlOpts) Control { ctrl := Control{ Id: id, - Title: Title(title), + Title: &Title{Raw: title}, } if opts != nil { ctrl.Controls = opts.Controls diff --git a/types/oscal/nominal_catalog/param.go b/types/oscal/nominal_catalog/param.go index 22cdc45..9889e5f 100644 --- a/types/oscal/nominal_catalog/param.go +++ b/types/oscal/nominal_catalog/param.go @@ -6,8 +6,8 @@ import ( ) func (param *Param) TextRepresentation() string { - if param.Label != "" { - return fmt.Sprintf("[Assignment: %s]", param.Label) + if param.Label != nil { + return fmt.Sprintf("[Assignment: %s]", param.Label.Raw) } if param.Select != nil { @@ -18,7 +18,7 @@ func (param *Param) TextRepresentation() string { choicesList := make([]string, len(param.Select.Alternatives)) for i, v := range param.Select.Alternatives { - choicesList[i] = string(v) + choicesList[i] = string(v.Raw) } choices := strings.Join(choicesList, ", ")