Skip to content

Allow map keys with brackets #44

@darigaaz

Description

@darigaaz

Code:

	var s struct {
		MapStringString    map[string]string
		MapStringPtrStruct map[string]struct {
			ID string
		}
		MapStringMapStringString map[string]map[string]string
	}

	vals := url.Values{
		"MapStringString[a[b][c]d]":             []string{"MapStringString[a[b][c]d]"},
		"MapStringString[name.with.dots]":       []string{"MapStringString[name.with.dots]"},
		"MapStringPtrStruct[k2]ID":              []string{"MapStringPtrStruct[k2]ID"},
		"MapStringMapStringString[a[b[c]d]]q]w": []string{"MapStringMapStringString[a[b[c]d]]q]w"},
	}

	dec := formam.NewDecoder(nil)

Expected: no errors, correct parsing with brakets in key's names
Actual: uninformative unrelated error: error when decode formam: has an array index but it is a string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions