45
45
]).
46
46
47
47
-export_type ([ state / 0
48
+ , allowed_errors / 0
48
49
]).
49
50
50
51
% % Includes
56
57
, current_schema :: jesse :json_term ()
57
58
, current_path :: [binary () | non_neg_integer ()]
58
59
% % current path in reversed order
59
- , allowed_errors :: non_neg_integer () | 'infinity'
60
+ , allowed_errors :: allowed_errors ()
60
61
, error_list :: list ()
61
62
, error_handler :: fun (( jesse_error :error_reason ()
62
63
, [jesse_error :error_reason ()]
70
71
| ? not_found
71
72
)
72
73
, external_validator :: external_validator ()
73
- , id :: http_uri :uri () | ' undefined'
74
+ , id :: http_uri :uri () | undefined
74
75
}
75
76
).
76
77
78
+ -type allowed_errors () :: non_neg_integer ()
79
+ | ? infinity .
80
+
77
81
-type external_validator () :: fun ((jesse :json_term (), state ()) -> state ())
78
82
| undefined .
79
83
@@ -88,7 +92,7 @@ add_to_path(State, Property) ->
88
92
State # state {current_path = [Property | CurrentPath ]}.
89
93
90
94
% % @doc Getter for `allowed_errors'.
91
- -spec get_allowed_errors (State :: state ()) -> non_neg_integer ().
95
+ -spec get_allowed_errors (State :: state ()) -> allowed_errors ().
92
96
get_allowed_errors (# state {allowed_errors = AllowedErrors }) ->
93
97
AllowedErrors .
94
98
@@ -172,9 +176,9 @@ new(JsonSchema, Options) ->
172
176
remove_last_from_path (State = # state {current_path = [_Property | Path ]}) ->
173
177
State # state {current_path = Path }.
174
178
175
- % % @doc Getter for `allowed_errors'.
179
+ % % @doc Setter for `allowed_errors'.
176
180
-spec set_allowed_errors ( State :: state ()
177
- , AllowedErrors :: non_neg_integer ()
181
+ , AllowedErrors :: allowed_errors ()
178
182
) -> state ().
179
183
set_allowed_errors (# state {} = State , AllowedErrors ) ->
180
184
State # state {allowed_errors = AllowedErrors }.
0 commit comments