in pkg/webhook/validation.go [37:67]
func validateUpdate(oldSpec, newSpec *nexusApi.NexusRepositorySpec) error {
if err := validateCreate(newSpec); err != nil {
return err
}
oldspecm, err := specToMap(oldSpec)
if err != nil {
return fmt.Errorf("unable to convert spec to map: %w", err)
}
newspecm, err := specToMap(newSpec)
if err != nil {
return fmt.Errorf("unable to convert spec to map: %w", err)
}
for oldFormat, oldFormatVal := range oldspecm {
val, ok := newspecm[oldFormat]
if !ok {
return fmt.Errorf("repository format %s cannot be changed to another", oldFormat)
}
for oldType := range oldFormatVal {
_, ok = val[oldType]
if !ok {
return fmt.Errorf("repository type %s cannot be changed to another", oldType)
}
}
}
return nil
}