Skip to content

Commit 4a6dbac

Browse files
authored
[elixir] Update dialyzer spec (#20024)
* Update evaluate_response spec to support returning a list of structs * Update elixir samples
1 parent e131d52 commit 4a6dbac

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ defmodule {{moduleName}}.RequestBuilder do
160160

161161
### Returns
162162

163-
- `{:ok, struct}` or `{:ok, Tesla.Env.t()}` on success
163+
- `{:ok, struct}`, {:ok, [struct]} or `{:ok, Tesla.Env.t()}` on success
164164
- `{:error, term}` on failure
165165
"""
166-
@spec evaluate_response(Tesla.Env.result(), response_mapping) :: {:ok, struct()} | Tesla.Env.result()
166+
@spec evaluate_response(Tesla.Env.result(), response_mapping) ::
167+
{:ok, struct() | [struct()] | Tesla.Env.t()} | {:error, Tesla.Env.t() | any()}
167168
def evaluate_response({:ok, %Tesla.Env{} = env}, mapping) do
168169
resolve_mapping(env, mapping, nil)
169170
end

samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ defmodule OpenapiPetstore.RequestBuilder do
162162
163163
### Returns
164164
165-
- `{:ok, struct}` or `{:ok, Tesla.Env.t()}` on success
165+
- `{:ok, struct}`, {:ok, [struct]} or `{:ok, Tesla.Env.t()}` on success
166166
- `{:error, term}` on failure
167167
"""
168-
@spec evaluate_response(Tesla.Env.result(), response_mapping) :: {:ok, struct()} | Tesla.Env.result()
168+
@spec evaluate_response(Tesla.Env.result(), response_mapping) ::
169+
{:ok, struct() | [struct()] | Tesla.Env.t()} | {:error, Tesla.Env.t() | any()}
169170
def evaluate_response({:ok, %Tesla.Env{} = env}, mapping) do
170171
resolve_mapping(env, mapping, nil)
171172
end

0 commit comments

Comments
 (0)