@@ -15,6 +15,10 @@ function val_enum(val::Dict, lst)
15
15
end
16
16
true
17
17
end
18
+ function val_unique_items (val:: Vector , is_unique)
19
+ is_unique || return true
20
+ return length (Set (val)) == length (val)
21
+ end
18
22
19
23
const MSG_INVALID_API_PARAM = Dict {Symbol,Function} ([
20
24
:maximum => (val,excl)-> string (" must be a value less than " , excl ? " or equal to " : " " , val),
@@ -23,7 +27,8 @@ const MSG_INVALID_API_PARAM = Dict{Symbol,Function}([
23
27
:minLength => (len)-> string (" length must be greater than or equal to " , len),
24
28
:maxItems => (val)-> string (" number of items must be less than or equal to " , val),
25
29
:minItems => (val)-> string (" number of items must be greater than or equal to " , val),
26
- :enum => (lst)-> string (" value is not from the allowed values" , lst)
30
+ :uniqueItems => (val)-> string (" items must be unique" ),
31
+ :enum => (lst)-> string (" value is not from the allowed values" , lst),
27
32
])
28
33
29
34
const VAL_API_PARAM = Dict {Symbol,Function} ([
@@ -33,7 +38,8 @@ const VAL_API_PARAM = Dict{Symbol,Function}([
33
38
:minLength => val_min_length,
34
39
:maxItems => val_max_length,
35
40
:minItems => val_min_length,
36
- :enum => val_enum
41
+ :uniqueItems => val_unique_items,
42
+ :enum => val_enum,
37
43
])
38
44
39
45
function validate_param (param, operation, rule, value, args... )
0 commit comments