Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func parseInput[TInput any](app *OApiApp, c *fiber.Ctx, path string, options *Op
fieldNameParts := strings.Split(fullFieldName, ".")
fieldName := fieldNameParts[len(fieldNameParts)-1]

// Extract expected type
expectedType := fieldParts[1]
// Extract expected type and trim whitespace
expectedType := strings.TrimSpace(fieldParts[1])

// Extract actual type from the first part
typePart := strings.TrimPrefix(parts[0], "json: cannot unmarshal ")
// Extract actual type from the first part and trim whitespace
typePart := strings.TrimSpace(strings.TrimPrefix(parts[0], "json: cannot unmarshal "))

return input, fmt.Errorf("invalid type for field '%s': expected %s but got %s",
fieldName, expectedType, typePart)
Expand Down
Loading