Skip to content

nested structs aren't marshaled properly if naming convention set #278

Closed
@shdunning

Description

@shdunning

One of the cool features of this library is that we can set field naming strategy like so...

extra.SetNamingStrategy(extra.LowerCaseWithUnderscores)

...however it does not work correctly for nested structs. Consider the following:

type Foo struct {
	Bar struct {
		Thing1 string
		Thing2 string
	}
}

We'd expect a Foo struct to get it's Foo.Bar.Thing1 and Foo.Bar.Thing2 marshaled into json fields foo.bar.thing1 and foo.bar.thing2 but only one of the fields actually gets marshaled correctly (foo.bar.thing1 in this case).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions