Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified REST API handlers #3776

Merged
merged 4 commits into from
Sep 27, 2022

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Sep 27, 2022

Unify the handler configuration for Client and Admin REST API.

  • Make Admin API handlers configurable
  • Specify only handler suffixes instead of the long module names
  • Delegate route declaration to handler modules - this way the whole logic of a handler is in one module, and there are no long lists of Cowboy routes.

Remaining work after this PR:

  • Document the updated REST API, including this change.

@mongoose-im

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Base: 82.87% // Head: 82.89% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (4ecb229) compared to base (0b4cd4e).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/unified-rest-api    #3776      +/-   ##
============================================================
+ Coverage                     82.87%   82.89%   +0.01%     
============================================================
  Files                           529      529              
  Lines                         33712    33735      +23     
============================================================
+ Hits                          27939    27964      +25     
+ Misses                         5773     5771       -2     
Impacted Files Coverage Δ
src/mongoose_http_handler.erl 100.00% <ø> (ø)
src/mongoose_admin_api/mongoose_admin_api.erl 95.08% <100.00%> (+0.34%) ⬆️
...mongoose_admin_api/mongoose_admin_api_contacts.erl 100.00% <100.00%> (ø)
...c/mongoose_admin_api/mongoose_admin_api_domain.erl 100.00% <100.00%> (ø)
...rc/mongoose_admin_api/mongoose_admin_api_inbox.erl 100.00% <100.00%> (ø)
...mongoose_admin_api/mongoose_admin_api_messages.erl 100.00% <100.00%> (ø)
.../mongoose_admin_api/mongoose_admin_api_metrics.erl 100.00% <100.00%> (ø)
src/mongoose_admin_api/mongoose_admin_api_muc.erl 100.00% <100.00%> (ø)
...ongoose_admin_api/mongoose_admin_api_muc_light.erl 100.00% <100.00%> (ø)
...mongoose_admin_api/mongoose_admin_api_sessions.erl 100.00% <100.00%> (ø)
... and 21 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mongoose-im

This comment was marked as outdated.

Paweł Chrząszcz added 4 commits September 27, 2022 15:10
Also: delegate route specification to handlers.
Reason: paths are handler-specific, and it is good to have the whole
logic of each handler in its respective module.
Also: delegate route specification to handlers.
Reason: paths are handler-specific, and it is good to have the whole
logic of each handler in its respective module.
@mongoose-im
Copy link
Collaborator

mongoose-im commented Sep 27, 2022

small_tests_24 / small_tests / 4ecb229
Reports root / small


small_tests_25 / small_tests / 4ecb229
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 4ecb229
Reports root/ big
OK: 3830 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 4ecb229
Reports root/ big
OK: 1991 / Failed: 0 / User-skipped: 745 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 4ecb229
Reports root/ big
OK: 1991 / Failed: 0 / User-skipped: 745 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 4ecb229
Reports root/ big
OK: 3830 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 4ecb229
Reports root/ big
OK: 3804 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 4ecb229
Reports root/ big
OK: 3830 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 4ecb229
Reports root/ big
OK: 2112 / Failed: 0 / User-skipped: 624 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 4ecb229
Reports root/ big
OK: 4215 / Failed: 1 / User-skipped: 97 / Auto-skipped: 0

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_unsubscribe_after_presence_unsubscription_2483@localhost">>},
         {<<"to">>,
        <<"bob_unsubscribe_after_presence_unsubscription_2483@localhost/res1">>},
         {<<"type">>,<<"headline">>}],
        [{xmlel,<<"event">>,
           [{<<"xmlns">>,
           <<"http://jabber.org/protocol/pubsub#event">>}],
           [{xmlel,<<"items">>,
            [{<<"node">>,<<"cOgnxzCC/+Da2SI/1wkYWw==">>}],
            [{xmlel,<<"item">>,
               [{<<"id">>,<<"salmon">>}],
               [{xmlel,<<"entry">>,
                  [{<<"xmlns">>,
                  <<"http://www.w3.org/2005/Atom">>}],
                  []}]}]}]},
         {xmlel,<<"headers">>,
           [{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
           []}]}]},
   [{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
       {line,384}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 4ecb229
Reports root/ big
OK: 2452 / Failed: 0 / User-skipped: 619 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 4ecb229
Reports root/ big
OK: 4190 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 4ecb229
Reports root/ big
OK: 4204 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 4ecb229
Reports root/ big
OK: 2292 / Failed: 0 / User-skipped: 611 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 4ecb229
Reports root/ big
OK: 4204 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0

@chrzaszcz chrzaszcz changed the title Unified Rest API handlers Unified REST API handlers Sep 27, 2022
@chrzaszcz chrzaszcz marked this pull request as ready for review September 27, 2022 13:45
Copy link
Contributor

@arcusfelis arcusfelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@arcusfelis arcusfelis merged commit fecb1bd into feature/unified-rest-api Sep 27, 2022
@arcusfelis arcusfelis deleted the unified-rest-api-handlers branch September 27, 2022 14:16
@chrzaszcz chrzaszcz added this to the 6.0.0 milestone Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants