cnabio/cnab-go

Cannot validate a parameter whose default is {}

Closed this issue · 1 comments

When we set a parameter to its default value, we are using fmt.Sprintf which isn't the correct logic as it doesn't take into account objects. Here is an example of the bug that causes getporter/porter#1738

We should use the same custom logic that we use elsewhere in cnab-go when working with a parameter value, depending on its type we have special handling for strings, primitives and objects.

I think this is caused by the yaml parser that we are using in Porter to set the parameter default. It's importing the default, {} as map[interface{}]interface{} when it should be map[string]interface{} because that's the correct json representation. It's not a cnab-go bug.