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

[erlang-server] minor bug fixes #9784

Merged
merged 1 commit into from
Jun 19, 2021

Conversation

sebastiw
Copy link
Contributor

dialyzer fixes for erlang-server

ping @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10)

solves two dialyzer problems.
First one is this issue #6354 and the corresponding dialyzer output

X_server.erl
Line 54 Column 66: The call X_server:store_key('env', NewEnv::[any()], Opts::#{'env':=#{'dispatch':=cowboy_router:dispatch_rules()}}) will never return since it differs in the 3rd argument from the success typing arguments: (any(), any(), [tuple()])

Line 57 Column 65: The call X_server:store_key(Key::any(), Value::any(), Opts::#{'env':=#{'dispatch':=cowboy_router:dispatch_rules()}}) will never return since it differs in the 3rd argument from the success typing arguments: (any(), any(), [tuple()])

Line 66 Column 1: Function store_key/3 has no local return

Line 67 Column 28: The call lists:keystore(Key::any(), 1, Opts::#{'env':=#{'dispatch':=cowboy_router:dispatch_rules()}}, {_,_}) will never return since the success typing is (any(), pos_integer(), maybe_improper_list(), tuple()) -> nonempty_maybe_improper_list() and the contract is (Key, N, TupleList1, NewTuple) -> TupleList2 when Key :: term(), N :: pos_integer(), TupleList1 :: [Tuple], TupleList2 :: [Tuple,...], NewTuple :: Tuple, Tuple :: tuple()

The second dialyzer problem is

X_default_logic_handler.erl
Line 8 Column 2: The return type {binary() | non_neg_integer(),#{binary()=>binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | [])},atom() | binary() | [any()] | number() | {{non_neg_integer(),1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12,1..255},{byte(),byte(),byte()}} | {'with_tail',_,binary()} | #{atom() | binary()=>_}} in the specification of handle_request/3 is not a subtype of {binary() | non_neg_integer(),#{binary()=>binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | [])},#{}}, which is the expected return type for the callback of X_logic_handler behaviour

It's coming from #{} in logic_handler.mustache but the from default_logic_handler.mustache it's jsx:json_term()

{Status :: cowboy:http_status(), Headers :: cowboy:http_headers(), Body :: jsx:json_term()}.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328 wing328 changed the title [erlang-server] spec fixes [erlang-server] minor bug fixes Jun 17, 2021
@wing328
Copy link
Member

wing328 commented Jun 17, 2021

Built locally with update samples and the result is good

===> Analyzing applications...
===> Compiling jesse
===> Compiling jsx
===> Compiling rfc3339
===> Compiling cowlib
===> Compiling ranch
===> Compiling cowboy
===> Analyzing applications...
===> Compiling openapi
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.254 s
[INFO] Finished at: 2021-06-17T17:20:46+08:00
[INFO] ------------------------------------------------------------------------

Will merge it this weekend if no further question/feedback from anyone.

@wing328 wing328 added this to the 5.2.0 milestone Jun 17, 2021
@wing328 wing328 merged commit 7335007 into OpenAPITools:master Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants