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

[bug] Nested fields not encoded in dot format #175

Closed
Andrew-M-C opened this issue Jun 15, 2021 · 1 comment
Closed

[bug] Nested fields not encoded in dot format #175

Andrew-M-C opened this issue Jun 15, 2021 · 1 comment

Comments

@Andrew-M-C
Copy link

Describe the bug
As described in decoder: Keys are "paths" in dotted notation to the struct fields and nested structs
However, encoder does not acted like this.

Versions

  • Go version: go1.16.2 darwin/amd64
  • package version: v1.2.0

Steps to Reproduce

package main

import (
	"fmt"
	
	"github.com/gorilla/schema"
)

type config struct {
	User struct{
		Username string `schema:"username"`
	} `schema:"user"`
}

func main() {
	c := config{}
	c.User.Username = "gorilla"
	
	m := map[string][]string{}
	enc := schema.NewEncoder()
	
	enc.Encode(&c, m)
	fmt.Printf("config by gorilla: %+v", m)
}
Expected config by gorilla: map[user.username:[gorilla]]
Actually got config by gorilla: map[username:[gorilla]]
@Andrew-M-C Andrew-M-C added the bug label Jun 15, 2021
@stale
Copy link

stale bot commented Sep 3, 2021

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Sep 3, 2021
@stale stale bot closed this as completed Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant