INNER CODE UNIT · Go

func

stackrox/kube-linter · pkg/templates/codegen/main.go:70

func (p *Params) Validate() error {
	var validationErrors []string
	{{- range . }}
	{{- if eq .ParamDesc.Type "object" }}
	return fmt.Errorf("parameter validation not yet supported for object type \"{{ .ParamDesc.Key }}\"")
	{{- end }}
	{{- if .ParamDesc.Required }}
	{{- if ne .ParamDesc.Type "string" }}
	return fmt.Errorf("required parameter validation is currently only supported for strings, but {{ .ParamDesc.Key }} is not")
	{{- end }}
	if p.{{ .ParamDesc.XXXStructFieldName }} == "" {
		validationErrors = append(validationErrors, "required param {{.ParamDesc.Name}} not found")
	}
	{{- end }}
	{{- if .ParamDesc.Enum }}
	{{- if eq .ParamDesc.Type "array" }}
	for _, value := range p.{{ .ParamDesc.XXXStructFieldName }} {
		var found bool

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…