in pkg/webhook/validation.go [10:35]
func validateCreate(spec *nexusApi.NexusRepositorySpec) error {
specm, err := specToMap(spec)
if err != nil {
return fmt.Errorf("unable to convert spec to map: %w", err)
}
if len(specm) > 1 {
return fmt.Errorf("repository must have only one format - go, maven, npm, etc")
}
if len(specm) == 0 {
return fmt.Errorf("repository format is not specified")
}
for _, v := range specm {
if len(v) > 1 {
return fmt.Errorf("repository must have only one type - hosted, proxy or group")
}
if len(v) == 0 {
return fmt.Errorf("repository type is not specified")
}
}
return nil
}