mirror of
https://github.com/valitydev/jesse.git
synced 2024-11-06 09:35:23 +00:00
$ref should not have other sibling properties. fix #54
This commit is contained in:
parent
28dd963cd2
commit
de3f1cbb47
@ -82,6 +82,7 @@
|
||||
|
||||
%% Constant definitions for schema errors
|
||||
-define(invalid_dependency, 'invalid_dependency').
|
||||
-define(only_ref_allowed, 'only_ref_allowed').
|
||||
-define(schema_invalid, 'schema_invalid').
|
||||
-define(schema_not_found, 'schema_not_found').
|
||||
-define(schema_unsupported, 'schema_unsupported').
|
||||
|
@ -61,8 +61,13 @@
|
||||
, JsonSchema :: jesse:schema()
|
||||
, State :: jesse_state:state()
|
||||
) -> jesse_state:state() | no_return().
|
||||
check_value(Value, [{?REF, RefSchemaURI} | _Attrs], State) ->
|
||||
validate_ref(Value, RefSchemaURI, State);
|
||||
check_value(Value, [{?REF, RefSchemaURI} | Attrs], State) ->
|
||||
case Attrs of
|
||||
[] ->
|
||||
validate_ref(Value, RefSchemaURI, State);
|
||||
_ ->
|
||||
handle_schema_invalid(?only_ref_allowed, State)
|
||||
end;
|
||||
check_value(Value, [{?TYPE, Type} | Attrs], State) ->
|
||||
NewState = check_type(Value, Type, State),
|
||||
check_value(Value, Attrs, NewState);
|
||||
|
@ -78,8 +78,13 @@
|
||||
, JsonSchema :: jesse:schema()
|
||||
, State :: jesse_state:state()
|
||||
) -> jesse_state:state() | no_return().
|
||||
check_value(Value, [{?REF, RefSchemaURI} | _Attrs], State) ->
|
||||
validate_ref(Value, RefSchemaURI, State);
|
||||
check_value(Value, [{?REF, RefSchemaURI} | Attrs], State) ->
|
||||
case Attrs of
|
||||
[] ->
|
||||
validate_ref(Value, RefSchemaURI, State);
|
||||
_ ->
|
||||
handle_schema_invalid(?only_ref_allowed, State)
|
||||
end;
|
||||
check_value(Value, [{?TYPE, Type} | Attrs], State) ->
|
||||
NewState = check_type(Value, Type, State),
|
||||
check_value(Value, Attrs, NewState);
|
||||
|
Loading…
Reference in New Issue
Block a user