MCPcopy Index your code
hub / github.com/cortexlabs/cortex / validateInterface

Function validateInterface

pkg/lib/configreader/interface.go:77–92  ·  view source on GitHub ↗
(val interface{}, v *InterfaceValidation)

Source from the content-addressed store, hash-verified

75}
76
77func validateInterface(val interface{}, v *InterfaceValidation) (interface{}, error) {
78 if v.RequireCortexResources {
79 if err := checkOnlyCortexResources(val); err != nil {
80 return nil, err
81 }
82 } else if !v.AllowCortexResources {
83 if err := checkNoCortexResources(val); err != nil {
84 return nil, err
85 }
86 }
87
88 if v.Validator != nil {
89 return v.Validator(val)
90 }
91 return val, nil
92}
93
94func checkNoCortexResources(obj interface{}) error {
95 if objStr, ok := obj.(string); ok {

Callers 2

ValidateInterfaceMissingFunction · 0.85

Calls 2

checkOnlyCortexResourcesFunction · 0.85
checkNoCortexResourcesFunction · 0.85

Tested by

no test coverage detected