Skip to content

Commit

Permalink
schema load redirect typo (2600hz#3875)
Browse files Browse the repository at this point in the history
* schema load redirect typo

* fix formatters test

* update referenced fun
  • Loading branch information
lazedo authored and mark2600 committed Jun 27, 2017
1 parent d507566 commit f90dfe9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions core/kazoo_endpoint/test/kz_formatters_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

-include_lib("eunit/include/eunit.hrl").

-define(SCHEMA_TEST_OPTIONS, [{'schema_loader_fun', fun kz_json_schema:fload/1}
,{'allowed_errors', 'infinity'}
,{'extra_validator', fun kz_json_schema_extensions:extra_validator/2}
,{'setter_fun', fun kz_json:set_value/3}
,{'validator_options', ['use_defaults'
,'apply_defaults_to_empty_objects'
]}
]).

-define(OFFNET_REQ, kz_json:from_list([{<<"Custom-SIP-Headers">>
,kz_json:from_list([{<<"Diversions">>
,[<<"sip:[email protected];counter=1">>]
Expand Down Expand Up @@ -169,9 +178,9 @@ replace_value_test_() ->
formatter_validation_test_() ->
{'ok', Schema} = kz_json_schema:fload(<<"formatters">>),

[?_assertMatch({'ok', _}, kz_json_schema:validate(Schema, ?FROM))
,?_assertMatch({'ok', _}, kz_json_schema:validate(Schema, ?DIVERSION))
,?_assertMatch({'ok', _}, kz_json_schema:validate(Schema, ?CALLER_ID_NAME))
[?_assertMatch({'ok', _}, kz_json_schema:validate(Schema, ?FROM, ?SCHEMA_TEST_OPTIONS))
,?_assertMatch({'ok', _}, kz_json_schema:validate(Schema, ?DIVERSION, ?SCHEMA_TEST_OPTIONS))
,?_assertMatch({'ok', _}, kz_json_schema:validate(Schema, ?CALLER_ID_NAME, ?SCHEMA_TEST_OPTIONS))
].

formatters_test_() ->
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_schemas/src/kz_json_schema.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
-spec load(ne_binary() | string()) -> {'ok', kz_json:object()} |
{'error', any()}.
load(<<"./", Schema/binary>>) -> load(Schema);
load(<<"file://", Schema/binary>>) -> fload(Schema);
load(<<"file://", Schema/binary>>) -> load(Schema);
load(<<_/binary>> = Schema) ->
case kz_datamgr:open_cache_doc(?KZ_SCHEMA_DB, Schema, [{'cache_failures', ['not_found']}]) of
{'error', _E}=E -> E;
Expand Down

0 comments on commit f90dfe9

Please sign in to comment.