func getDeclaredParams()

in script/validator/validator.go [416:442]


func getDeclaredParams(k camelapiv1.Kamelet) map[string]bool {
	res := make(map[string]bool)
	if k.Spec.Definition != nil {
		for p := range k.Spec.Definition.Properties {
			res[p] = true
		}
	}
	// include beans
	var templateData interface{}
	if err := json.Unmarshal(k.Spec.Template.RawMessage, &templateData); err != nil {
		handleGeneralError("cannot unmarshal template", err)
	}
	if fd, ok := templateData.(map[string]interface{}); ok {
		beans := fd["beans"]
		if bl, ok := beans.([]interface{}); ok {
			for _, bdef := range bl {
				if bmap, ok := bdef.(map[string]interface{}); ok {
					beanName := bmap["name"]
					if beanNameStr, ok := beanName.(string); ok {
						res[beanNameStr] = true
					}
				}
			}
		}
	}
	return res
}