Skip to content

Commit

Permalink
Refactor: Extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed Sep 17, 2020
1 parent 062d3e7 commit a400958
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions metaschema/parser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ func (df *DefineField) IsMarkup() bool {
return df.AsType == AsTypeMarkupMultiLine
}

func (df *DefineField) JsonName() string {
return "value"
}

type DefineFlag struct {
Name string `xml:"name,attr"`
AsType datatype `xml:"as-type,attr"`
Expand Down
2 changes: 1 addition & 1 deletion metaschema/templates/generated_models.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type {{.GoTypeName}} struct {
{{.GoName}} {{.GoDatatype}} `xml:"{{.XmlName}},attr,omitempty" json:"{{.JsonName}},omitempty"`
{{end -}}

Value string `xml:",chardata" json:"value,omitempty"`
Value string `xml:",chardata" json:"{{.JsonName}},omitempty"`
}
{{- else}}
{{- if .IsMarkup }}
Expand Down

0 comments on commit a400958

Please sign in to comment.