Name a nested payload's problems with PayloadError.Within

The notify module names the problems of an action, an object inside its
payload, by the action's place in the payload. The module routes need
the same for a payload sent inside a larger request body, so the naming
becomes a method of PayloadError. What notify reports does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-12-01 21:51:10 -06:00
1 parent 2e291817d3
commit cbac0b5f03
3 files changed
+35 -9

No files matched your search

+1 -9
View File
@@ -167,15 +167,7 @@ func nestedProblems(field string, err error) []string {
if !errors.As(err, &pe) {
return []string{field + ": " + err.Error()}
}
problems := make([]string, len(pe.Problems))
for i, problem := range pe.Problems {
if rest, ok := strings.CutPrefix(problem, "body: "); ok {
problems[i] = field + ": " + rest
continue
}
problems[i] = field + "." + problem
}
return problems
return pe.Within(field)
}
// parsePriority reads a priority given as 1-5 or by name. nil is the