clarify interface comments

This commit is contained in:
Shreyas Goenka 2024-09-04 11:15:00 +02:00
parent 46585bbd3f
commit 6bd7ad0fb2
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 3 additions and 4 deletions

View File

@ -182,10 +182,9 @@ func (c *constructor) walk(typ reflect.Type) error {
case reflect.Float32, reflect.Float64:
s = Schema{Type: NumberType}
case reflect.Interface:
// Interface or any types are not serialized to JSON by the default JSON
// unmarshaller (json.Unmarshal). They likely thus are parsed by the
// dynamic configuration tree and we should support arbitary values here.
// Eg: variables.default can be anything.
// We cannot determine the schema for fields of interface type just based
// on the type information. Thus we'll set the empty schema here and allow
// arbitrary values.
s = Schema{}
default:
return fmt.Errorf("unsupported type: %s", typ.Kind())