strcase icon indicating copy to clipboard operation
strcase copied to clipboard

Generate camelCase from snake-case XML tags

Open ranganath42 opened this issue 4 years ago • 0 comments

How about adding an option to generate camelCase Go structs from snake-case XML structs? For example, from

<Address>
    <zip-code/>
    <city/>
</Address>

To generate,

type Address struct {
        XMLName xml.Name `xml:"Address,omitempty" json:"Address,omitempty"`
        City *City `xml:"city,omitempty" json:"city,omitempty"`
        ZipCode *ZipCode `xml:"zip-code,omitempty" json:"zip-code,omitempty"`
}

type City struct {
        XMLName xml.Name `xml:"city,omitempty" json:"city,omitempty"`
}

type ZipCode struct {
        XMLName xml.Name `xml:"zip-code,omitempty" json:"zip-code,omitempty"`
}

ranganath42 avatar Nov 23 '20 08:11 ranganath42