Merge with default values doesn't work on cy create-stackforms-env
When creating a project using the new stackforms command cy create-stackforms-env -> create-env.go I added logic to fetch the defaults values first to merge them with the values provided by the user.
The merge doesn't happend because the lib i'm using (mergo) can merge only 2 similar structs.
On this line:
mergo.Merge(&vars, defaultValues, mergo.WithOverride)
The DefaultValues are recovered from the common.ParseFormsConfig() function that take a *model.FormUseCase and return a map[string]map[string]map[string]any (which is the format expected for a vars input for stackforms).
The vars variable is a map[string]interface{} and so, since it's not the same type as DefaultValues it doesn't merge the values.
We need to use the same types for both, this means changing the vars type, but it will require to refactor the common.UpdateMapField() function that is used to apply the -V args. This function is also related to this issue.
It'd be nice to also look into https://github.com/darccio/mergo?tab=readme-ov-file#transformers to see if it can be done by writing our own transformer
fixed by #313