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

Set default value when null is passed to GraphQL API #3803

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

jacekwegr
Copy link
Contributor

@jacekwegr jacekwegr commented Oct 10, 2022

This PR changes how arguments are processed before being passed to the resolver. When an argument has an explicit null value, the GraphQL library tries to set its value to a default one if one exists.

@mongoose-im

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Base: 82.87% // Head: 82.91% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (def8dce) compared to base (5b3e266).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3803      +/-   ##
==========================================
+ Coverage   82.87%   82.91%   +0.04%     
==========================================
  Files         529      529              
  Lines       33808    33810       +2     
==========================================
+ Hits        28017    28035      +18     
+ Misses       5791     5775      -16     
Impacted Files Coverage Δ
src/graphql/mongoose_graphql.erl 91.48% <100.00%> (+0.37%) ⬆️
src/mod_roster_riak.erl 96.92% <0.00%> (-1.54%) ⬇️
src/mod_roster.erl 78.70% <0.00%> (-0.48%) ⬇️
src/ejabberd_c2s.erl 88.93% <0.00%> (-0.30%) ⬇️
src/mod_muc_log.erl 62.82% <0.00%> (ø)
src/mod_muc.erl 74.47% <0.00%> (+0.23%) ⬆️
src/mod_muc_room.erl 78.68% <0.00%> (+0.28%) ⬆️
src/rdbms/mongoose_rdbms.erl 66.31% <0.00%> (+1.05%) ⬆️
src/mod_last.erl 88.05% <0.00%> (+1.49%) ⬆️
src/pubsub/node_pep.erl 79.62% <0.00%> (+1.85%) ⬆️
... and 4 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.

@jacekwegr jacekwegr marked this pull request as ready for review October 10, 2022 12:54
@jacekwegr jacekwegr force-pushed the set-default-when-null-is-passed-explicitly branch from 3b1c40d to a8bde9d Compare October 17, 2022 07:41
@mongoose-im

This comment was marked as outdated.

rebar.config Outdated
@@ -77,7 +77,7 @@
{worker_pool, "6.0.1"},

%%% HTTP tools
{graphql, {git, "https://github.com/esl/graphql-erlang.git", {branch, "master"}}},
{graphql, {git, "https://github.com/esl/graphql-erlang.git", {branch, "set-default-when-null-is-passed-explicitly"}}},
Copy link
Contributor

@JanuszJakubiec JanuszJakubiec Oct 18, 2022

Choose a reason for hiding this comment

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

this should be changed back to master after the library is merged

@jacekwegr jacekwegr force-pushed the set-default-when-null-is-passed-explicitly branch from a8bde9d to def8dce Compare October 18, 2022 09:56
@mongoose-im
Copy link
Collaborator

mongoose-im commented Oct 18, 2022

small_tests_24 / small_tests / def8dce
Reports root / small


small_tests_25 / small_tests / def8dce
Reports root / small


ldap_mnesia_24 / ldap_mnesia / def8dce
Reports root/ big
OK: 2082 / Failed: 0 / User-skipped: 772 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / def8dce
Reports root/ big
OK: 3961 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / def8dce
Reports root/ big
OK: 2082 / Failed: 0 / User-skipped: 772 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / def8dce
Reports root/ big
OK: 3961 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / def8dce
Reports root/ big
OK: 2218 / Failed: 0 / User-skipped: 636 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / def8dce
Reports root/ big
OK: 2560 / Failed: 0 / User-skipped: 629 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / def8dce
Reports root/ big
OK: 3935 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / def8dce
Reports root/ big
OK: 4335 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / def8dce
Reports root/ big
OK: 3961 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / def8dce
Reports root/ big
OK: 4335 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / def8dce
Reports root/ big
OK: 4321 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / def8dce
Reports root/ big
OK: 4333 / Failed: 2 / User-skipped: 97 / Auto-skipped: 0

muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive
{error,{{assertion_failed,assert,is_groupchat_message,
              [<<"Restorable message">>],
              undefined,"undefined"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {muc_SUITE,wait_for_mam_result,3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4394}]},
     {muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4130}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4126}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

smart_markers_SUITE:regular:one2one:remove_markers_when_removed_user
{error,{{timeout,true,[{times,50,false}]},
    [{mongoose_helper,do_wait_until,2,
              [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
               {line,371}]},
     {smart_markers_SUITE,'-remove_markers_when_removed_user/1-fun-2-',2,
                [{file,"/home/circleci/project/big_tests/tests/smart_markers_SUITE.erl"},
                 {line,244}]},
     {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,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log


riak_mnesia_24 / riak_mnesia / def8dce
Reports root/ big
OK: 2400 / Failed: 0 / User-skipped: 621 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / def8dce
Reports root/ big
OK: 4335 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0

@JanuszJakubiec JanuszJakubiec merged commit 7e797b0 into master Oct 18, 2022
@JanuszJakubiec JanuszJakubiec deleted the set-default-when-null-is-passed-explicitly branch October 18, 2022 13:39
@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.

4 participants