mirror of
https://github.com/Fishwaldo/huma.git
synced 2025-03-15 19:31:27 +00:00
fix: trim trailing dot from error locations
This commit is contained in:
parent
8aa6989f4c
commit
09e1ebac6a
1 changed files with 2 additions and 2 deletions
|
@ -46,7 +46,7 @@ func validAgainstSchema(ctx *hcontext, label string, schema *schema.Schema, data
|
|||
if err := recover(); err != nil {
|
||||
ctx.AddError(&ErrorDetail{
|
||||
Message: fmt.Errorf("unable to validate against schema: %w", err.(error)).Error(),
|
||||
Location: label,
|
||||
Location: strings.TrimSuffix(label, "."),
|
||||
Value: string(data),
|
||||
})
|
||||
|
||||
|
@ -72,7 +72,7 @@ func validAgainstSchema(ctx *hcontext, label string, schema *schema.Schema, data
|
|||
// those off to prevent duplicating data. (e.g. see the enum error)
|
||||
ctx.AddError(&ErrorDetail{
|
||||
Message: strings.TrimPrefix(desc.Description(), desc.Context().String()+" "),
|
||||
Location: label + strings.TrimPrefix(desc.Field(), "(root)"),
|
||||
Location: strings.TrimSuffix(label+strings.TrimPrefix(desc.Field(), "(root)"), "."),
|
||||
Value: desc.Value(),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue