Skip to content

Commit

Permalink
Add only not unique items into result errors
Browse files Browse the repository at this point in the history
  • Loading branch information
austinov committed Nov 7, 2018
1 parent f3a9dae commit f0dbd2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion errors.go
Expand Up @@ -81,7 +81,7 @@ type (
ResultErrorFields
}

// ItemsMustBeUniqueError. ErrorDetails: type
// ItemsMustBeUniqueError. ErrorDetails: type, item
ItemsMustBeUniqueError struct {
ResultErrorFields
}
Expand Down
4 changes: 2 additions & 2 deletions validation.go
Expand Up @@ -517,7 +517,7 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
// uniqueItems:
if currentSubSchema.uniqueItems {
var stringifiedItems []string
for _, v := range value {
for i, v := range value {
vString, err := marshalWithoutNumber(v)
if err != nil {
result.addInternalError(new(InternalError), context, value, ErrorDetails{"err": err})
Expand All @@ -527,7 +527,7 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
new(ItemsMustBeUniqueError),
context,
value,
ErrorDetails{"type": TYPE_ARRAY},
ErrorDetails{"type": TYPE_ARRAY, "item": i},
)
}
stringifiedItems = append(stringifiedItems, *vString)
Expand Down

0 comments on commit f0dbd2a

Please sign in to comment.