Skip to content

Commit b49ec6e

Browse files
wing328efcasado
andauthored
[fix][elixir] missing type mapping for AnyType (#22081)
* fix: unmapped anytype * add tests for any type in elixir client --------- Co-authored-by: Enrique Fernandez <[email protected]>
1 parent 4352a2f commit b49ec6e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public ElixirClientCodegen() {
226226
typeMapping.put("date", "Date.t");
227227
typeMapping.put("date-time", "DateTime.t");
228228
// other
229+
typeMapping.put("AnyType", "any()");
229230
typeMapping.put("ByteArray", "binary()");
230231
typeMapping.put("DateTime", "DateTime.t");
231232
typeMapping.put("UUID", "String.t");

modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,7 @@ components:
21342134
properties:
21352135
"@type":
21362136
type: string
2137+
any_type_property: {}
21372138
SingleRefType:
21382139
type: string
21392140
title: SingleRefType

samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ defmodule OpenapiPetstore.Model.Any do
88

99
@derive JSON.Encoder
1010
defstruct [
11-
:"@type"
11+
:"@type",
12+
:any_type_property
1213
]
1314

1415
@type t :: %__MODULE__{
15-
:"@type" => String.t | nil
16+
:"@type" => String.t | nil,
17+
:any_type_property => any() | nil
1618
}
1719

1820
def decode(value) do

0 commit comments

Comments
 (0)