Skip to content

Commit

Permalink
Fixing CR issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Jakubiec authored and Janusz Jakubiec committed Nov 8, 2022
1 parent 9671306 commit 4d4a0e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/graphql/mongoose_graphql_cowboy_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ config_spec() ->
<<"schema_endpoint">> => #option{type = atom,
validate = {enum, [admin, domain_admin, user]}},
<<"allowed_categories">> => #list{items = #option{type = binary,
validate = {enum, allowed_schemas()}}}},
validate = {enum, allowed_categories()}},
validate = unique_non_empty}},
format_items = map,
required = [<<"schema_endpoint">>],
process = fun ?MODULE:process_config/1}.
Expand Down Expand Up @@ -275,7 +276,7 @@ reply_error(Msg, Req, State) ->
Reply = cowboy_req:reply(Code, Req2),
{stop, Reply, State}.

allowed_schemas() ->
allowed_categories() ->
[<<"checkAuth">>, <<"account">>, <<"domain">>, <<"last">>, <<"muc">>, <<"muc_light">>,
<<"session">>, <<"stanza">>, <<"roster">>, <<"vcard">>, <<"private">>, <<"metric">>,
<<"stat">>, <<"gdpr">>, <<"mnesia">>, <<"server">>, <<"inbox">>, <<"http_upload">>,
Expand Down
4 changes: 0 additions & 4 deletions src/graphql/mongoose_graphql_errors.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ format_error(internal_crash) ->
Msg = #{message => <<"GraphQL Internal Server Error">>,
extensions => #{code => internal_server_error}},
{500, Msg};
format_error({category_disabled, Category}) ->
Message = iolist_to_binary(io_lib:format("~p", [
#{message => <<"Category disabled">>, extensions => #{category => Category}}])),
{400, #{message => Message, extensions => #{code => category_disabled}}};
format_error(Err) ->
Msg = #{extensions => #{code => uncategorized},
message => iolist_to_binary(io_lib:format("~p", [Err]))},
Expand Down

0 comments on commit 4d4a0e0

Please sign in to comment.