|
48 | 48 | | ?not_in_range |
49 | 49 | | ?wrong_length |
50 | 50 | | ?wrong_size |
51 | | - | ?wrong_type. |
| 51 | + | ?wrong_type |
| 52 | + | ?external. |
52 | 53 |
|
53 | 54 | -type data_error_type() :: data_error() |
54 | 55 | | {data_error(), binary()}. |
@@ -209,11 +210,11 @@ check_value(Value, [{?DISALLOW, Disallow} | Attrs], State) -> |
209 | 210 | check_value(Value, [{?EXTENDS, Extends} | Attrs], State) -> |
210 | 211 | NewState = check_extends(Value, Extends, State), |
211 | 212 | check_value(Value, Attrs, NewState); |
212 | | -check_value(_Value, [], State) -> |
213 | | - State; |
214 | 213 | check_value(Value, [{?REF, RefSchemaURI} | Attrs], State) -> |
215 | 214 | NewState = validate_ref(Value, RefSchemaURI, State), |
216 | 215 | check_value(Value, Attrs, NewState); |
| 216 | +check_value(Value, [], State) -> |
| 217 | + maybe_external_check_value(Value, State); |
217 | 218 | check_value(Value, [_Attr | Attrs], State) -> |
218 | 219 | check_value(Value, Attrs, State). |
219 | 220 |
|
@@ -1031,3 +1032,12 @@ add_to_path(State, Property) -> |
1031 | 1032 | %% @private |
1032 | 1033 | remove_last_from_path(State) -> |
1033 | 1034 | jesse_state:remove_last_from_path(State). |
| 1035 | + |
| 1036 | +%% @private |
| 1037 | +maybe_external_check_value(Value, State) -> |
| 1038 | + case jesse_state:get_external_validator(State) of |
| 1039 | + undefined -> |
| 1040 | + State; |
| 1041 | + Fun -> |
| 1042 | + Fun(Value, State) |
| 1043 | + end. |
0 commit comments