Skip to content

incorrect field mask generated for deeply nested struct #1549

@houz42

Description

@houz42

🐛 Bug Report

if an input json is deeply nested, the generated field mask may be incorrect.

input: {"foo": {"bar": {"baz": {"a": 1, "b": 2}}}}
expected field mask: ["foo.bar.baz.a", "foo.bar.baz.b"]
got: ["foo.bar.baz.a", "foo.bar.baz.a"]

To Reproduce

add another test case in runtime/fieldmask_test.go.TestFieldMaskFromRequestBody before line 58:
{name: "deep", input: {"foo": {"bar": {"baz": {"a": 1, "b": 2}}}}, expected: newFieldMask("foo.bar.baz.a", "foo.bar.baz.b")},

it fails

Expected behavior

two different paths in the field mask

Actual Behavior

two same paths

Your Environment

mac OSX
go 1.14.1
(Environment name, version and operating system.)

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