Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow map keys with brackets #44

Open
darigaaz opened this issue Jan 30, 2021 · 0 comments · May be fixed by #45
Open

Allow map keys with brackets #44

darigaaz opened this issue Jan 30, 2021 · 0 comments · May be fixed by #45

Comments

@darigaaz
Copy link
Contributor

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

darigaaz added a commit to darigaaz/formam that referenced this issue Jan 30, 2021
@darigaaz darigaaz linked a pull request Jan 30, 2021 that will close this issue
darigaaz added a commit to darigaaz/formam that referenced this issue Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant