in schema/v1/inputs.go [41:73]
func (i *Input) compileToProto() (*proto.Spec_Content_Input, error) {
protoInput := &proto.Spec_Content_Input{}
if i.Type == nil {
return nil, fmt.Errorf("missing input type")
}
switch *i.Type {
case InputTypeBoolean:
protoInput.Type = proto.ValueType_boolean
case InputTypeArray:
protoInput.Type = proto.ValueType_array
case InputTypeNumber:
protoInput.Type = proto.ValueType_number
case InputTypeString:
protoInput.Type = proto.ValueType_string
case InputTypeStruct:
protoInput.Type = proto.ValueType_struct
default:
return nil, fmt.Errorf("unsupported input type: %v", i.Type)
}
if i.Default != nil {
protoV, err := (&valueCompiler{i.Default}).compile()
if err != nil {
return nil, fmt.Errorf("compiling default %v: %w", i.Default, err)
}
protoInput.Default = protoV
}
if i.Sensitive != nil && *i.Sensitive {
protoInput.Sensitive = true
}
return protoInput, nil
}