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

map[string]interface{} not working #133

Open
kotyara85 opened this issue Mar 12, 2024 · 1 comment
Open

map[string]interface{} not working #133

kotyara85 opened this issue Mar 12, 2024 · 1 comment

Comments

@kotyara85
Copy link

Hello there,
So I have this struct

type serviceAccount struct {
	Name           graphql.String
	Labels           map[string]interfaces{}
}

which results into

 failed to write query for struct field `Labels`: type map[string]interface {} is not supported, use [][2]interface{} instead

Is there a way to unmarhal this?

Thanks

@hgiasac
Copy link

hgiasac commented Mar 12, 2024

Hello @kotyara85,

You can try to add scalar:"true" tag to that field. The library will ignore inferring nested fields and decode directly.

type serviceAccount struct {
	Name           graphql.String
	Labels           map[string]interfaces{} `scalar:"true"`
}

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

No branches or pull requests

2 participants