From 9423f97a36154db3cab054cf0a259cca12effce2 Mon Sep 17 00:00:00 2001 From: Minhaj Uddin Khan Date: Wed, 16 Jan 2019 15:51:00 +0500 Subject: [PATCH] Fix set param id attribute --- metaschema/types.tmpl | 6 +++++- types/oscal/profile/profile.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/metaschema/types.tmpl b/metaschema/types.tmpl index 823328e4..b4a65e06 100644 --- a/metaschema/types.tmpl +++ b/metaschema/types.tmpl @@ -16,14 +16,18 @@ type {{toCamel .Name}} struct { {{- if eq "profile" .Name}} ID string `xml:"id,attr,omitempty" json:"id,omitempty"` {{- end}} - {{- range .Flags}} +{{- range .Flags}} {{- $cf := commentFlag .Name $m.DefineFlag}} {{- range $cf}} // {{ . }} {{- end}} {{- $dt := parseDatatype .Datatype $packageName}} + {{- if and (eq "id" .Name) (eq "profile" $packageName)}} + Id string `xml:"param-id,attr,omitempty" json:"id,omitempty"` + {{- else}} {{toCamel .Name}} {{if eq "" $dt}}string{{else}}{{$dt}}{{end}} `xml:"{{ .Name }},attr,omitempty" json:"{{toLowerCamel .Name}},omitempty"` {{- end}} +{{- end}} {{- range .Model.Field}} {{toCamel .Named}} {{if requiresPointer .Named $m}}*{{end}}{{packageImport .Named $m}}{{toCamel .Named}} `xml:"{{ .Named }},omitempty" json:"{{toLowerCamel .Named}},omitempty"` diff --git a/types/oscal/profile/profile.go b/types/oscal/profile/profile.go index f8fa02f1..f3f1fc2e 100644 --- a/types/oscal/profile/profile.go +++ b/types/oscal/profile/profile.go @@ -68,7 +68,7 @@ type Exclude struct { // A parameter setting, to be propagated to points of insertion type SetParam struct { - Id string `xml:"id,attr,omitempty" json:"id,omitempty"` + Id string `xml:"param-id,attr,omitempty" json:"id,omitempty"` Class string `xml:"class,attr,omitempty" json:"class,omitempty"` DependsOn string `xml:"depends-on,attr,omitempty" json:"dependsOn,omitempty"` Label catalog.Label `xml:"label,omitempty" json:"label,omitempty"`