mapstructure
mapstructure copied to clipboard
Mapping bool gives error "expected type 'bool', got unconvertible type 'string'"
I have a field in my JSON that looks like this
AllowedOAuthFlowsUserPoolClient: true
which I want to map to this field
AllowedOAuthFlowsUserPoolClient *bool type:"boolean"``
This gives me the error
* 'AllowedOAuthFlowsUserPoolClient' expected type 'bool', got unconvertible type 'string'
What should the value be, if not true ?
Do you have "weak types" enabled on the mapstructure config? (Or are using WeakDecode)?
I'm going to keep this open regardless because I think that pointers directly to the correct type shouldn't require weak types, since they're a common pattern in Go to also set whether it was set or not at all.
I "solved" it using weak types, but like you already mentioned I thought this wouldn't/shouldn't be needed here since the correct type was already given as input.