Swagger-codegen: [ELIXIR] Bug dialyzer typespecs not correct for Tesla API calls

Created on 24 Oct 2017  路  7Comments  路  Source: swagger-api/swagger-codegen

Description


%Tesla.Client{} uses typical middlewares such as Tesla.Middleware.Timeout or Tesla.Middleware.Fuse. When a server is unreachable for example the return value is usually something like {:error, :unavailable}. And in some cases, an exception can be thrown. However, the typespec generated by swagger codegen doesn't take this into account resulting in tons of error when doing type checking with dialyzer.

Swagger-codegen version


3.0.0 and latest master

Command line used for generation

defaults

Steps to reproduce

Generate code for any spec

Related issues/PRs


None

Suggest a fix/enhancement


See here for how the typespec is generated. This should probably include no_return and {:error, term} to be accurate given it's nearly impossible to predict all errors that all middlewares can generate.

Elixir Bug

All 7 comments

@edescourtis thanks for reporting the issue. May I know if you've time to submit a PR with the suggested fix?

cc @niku @chingor13

Perhaps! I will see what I can do.

@earldouglas
Hi, I just publish a PR that fixes typings in RequestBuilder.
The changes have fixed a lot of error more than I expected 馃槄

I guess It removes errors that is described in this issue.
So, I recommend checking that PR before you tackle this issue.

@niku I think you meant to mention @edescourtis

I'm very sorry for making a wrong mention 馃檱

Now, I send a mention to @edescourtis
Please read a comment https://github.com/swagger-api/swagger-codegen/issues/6798#issuecomment-339714863

@edescourtis https://github.com/swagger-api/swagger-codegen/pull/6821 by @niku has been merged into master. Please pull the latest master or use the SNAPSHOT version mentioned in the README to give it a try.

Was this page helpful?
0 / 5 - 0 ratings