fix(app,manifest): manifest serialization
All checks were successful
arcad/edge/pipeline/head This commit looks good

This commit is contained in:
2023-04-11 15:08:07 +02:00
parent 98ebd7a168
commit f5283b86ed
7 changed files with 86 additions and 22 deletions

View File

@ -26,28 +26,23 @@ func WithNamedPathsValidator(names ...NamedPath) app.MetadataValidator {
return true, nil
}
paths, ok := rawPaths.(map[any]any)
paths, ok := rawPaths.(app.MapStr)
if !ok {
return false, errors.Errorf("metadata['paths']: unexpected named path value type '%T'", rawPaths)
}
for n, p := range paths {
name, ok := n.(string)
if !ok {
return false, errors.Errorf("metadata['paths']: unexpected named path type '%T'", n)
}
if _, exists := set[NamedPath(name)]; !exists {
return false, errors.Errorf("metadata['paths']: unexpected named path '%s'", name)
if _, exists := set[NamedPath(n)]; !exists {
return false, errors.Errorf("metadata['paths']: unexpected named path '%s'", n)
}
path, ok := p.(string)
if !ok {
return false, errors.Errorf("metadata['paths']['%s']: unexpected named path value type '%T'", name, path)
return false, errors.Errorf("metadata['paths']['%s']: unexpected named path value type '%T'", n, path)
}
if !strings.HasPrefix(path, "/") {
return false, errors.Errorf("metadata['paths']['%s']: named path value should start with a '/'", name)
return false, errors.Errorf("metadata['paths']['%s']: named path value should start with a '/'", n)
}
}