[Elixir Client]Improve elixir client typings (#6665)

* [Elixir Client] Improve primitive typings

* [Elixir Client] Add type to models

Fix following dialyzer warnings in the sample:

```
:0: Unknown type 'Elixir.SwaggerPetstore.Model.ApiResponse':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.Client':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.Order':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterBoolean':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterComposite':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterNumber':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterString':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.Pet':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.User':t/0
```
This commit is contained in:
niku 2017-10-17 22:59:25 +09:00 committed by wing328
parent 07b408a44a
commit 62627f20bc
41 changed files with 320 additions and 72 deletions

View File

@ -3,9 +3,7 @@ package io.swagger.codegen.languages;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import io.swagger.codegen.*;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.*;
import io.swagger.models.Info;
import io.swagger.models.Model;
import io.swagger.models.Swagger;
@ -32,7 +30,6 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
"{:poison, \">= 1.0.0\"}"
);
public ElixirClientCodegen() {
super();
@ -420,14 +417,77 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
*/
@Override
public String getTypeDeclaration(Property p) {
// SubClasses of AbstractProperty
//
// ArrayProperty
// MapProperty
// PasswordProperty
// StringProperty
// EmailProperty
// ByteArrayProperty
// DateProperty
// UUIDProperty
// DateTimeProperty
// ObjectProperty
// AbstractNumericProperty
// BaseIntegerProperty
// IntegerProperty
// LongProperty
// DecimalProperty
// DoubleProperty
// FloatProperty
// BinaryProperty
// BooleanProperty
// RefProperty
// FileProperty
if (p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
Property inner = ap.getItems();
return getSwaggerType(p) + "[" + getTypeDeclaration(inner) + "]";
return "[" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapProperty) {
MapProperty mp = (MapProperty) p;
Property inner = mp.getAdditionalProperties();
return getSwaggerType(p) + "[String, " + getTypeDeclaration(inner) + "]";
return "%{optional(String.t) => " + getTypeDeclaration(inner) + "}";
} else if (p instanceof PasswordProperty) {
return "String.t";
} else if (p instanceof EmailProperty) {
return "String.t";
} else if (p instanceof ByteArrayProperty) {
return "binary()";
} else if (p instanceof StringProperty) {
return "String.t";
} else if (p instanceof DateProperty) {
return "Date.t";
} else if (p instanceof UUIDProperty) {
return "String.t";
} else if (p instanceof DateTimeProperty) {
return "DateTime.t";
} else if (p instanceof ObjectProperty) {
// How to map it?
return super.getTypeDeclaration(p);
} else if (p instanceof IntegerProperty) {
return "integer()";
} else if (p instanceof LongProperty) {
return "integer()";
} else if (p instanceof BaseIntegerProperty) {
return "integer()";
} else if (p instanceof DoubleProperty) {
return "float()";
} else if (p instanceof FloatProperty) {
return "float()";
} else if (p instanceof DecimalProperty) {
return "float()";
} else if (p instanceof AbstractNumericProperty) {
return "number()";
} else if (p instanceof BinaryProperty) {
return "binary()";
} else if (p instanceof BooleanProperty) {
return "boolean()";
} else if (p instanceof RefProperty) {
// How to map it?
return super.getTypeDeclaration(p);
} else if (p instanceof FileProperty) {
return "String.t";
}
return super.getTypeDeclaration(p);
}
@ -590,26 +650,8 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
buildTypespec(param.items, sb);
sb.append("}");
} else if (param.isPrimitiveType) {
// <type>() OR <type>.t
// Primitive types in Elixir
// https://hexdocs.pm/elixir/1.5.2/typespecs.html#types-and-their-syntax
//
// NOTE: List, Tuple and Map are declared as primitive in a variable `languageSpecificPrimitives`.
HashMap map = new HashMap<String, String>();
map.put("Integer", "integer()");
map.put("Float", "float()");
map.put("Boolean", "boolean()");
map.put("String", "String.t");
map.put("List", "list()");
map.put("Atom", "atom()");
map.put("Map", "map()");
map.put("Tuple", "tuple()");
map.put("PID", "pid()");
map.put("DateTime", "DateTime.t");
String dataType = (String) map.get(param.dataType);
sb.append(dataType);
// like `integer()`, `String.t`
sb.append(param.dataType);
} else if (param.isFile) {
sb.append("String.t");
} else {

View File

@ -9,6 +9,11 @@
{{#vars}}:"{{baseName}}"{{#hasMore}},
{{/hasMore}}{{/vars}}
]
@type t :: %__MODULE__{
{{#vars}}:"{{baseName}}" => {{{datatype}}}{{#hasMore}},
{{/hasMore}}{{/vars}}
}
end
defimpl Poison.Decoder, for: {{moduleName}}.Model.{{classname}} do

View File

@ -156,28 +156,28 @@ defmodule SwaggerPetstore.Api.Fake do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- number (Float): None
- double (Float): None
- pattern_without_delimiter (String): None
- byte (String): None
- number (float()): None
- double (float()): None
- pattern_without_delimiter (String.t): None
- byte (binary()): None
- opts (KeywordList): [optional] Optional parameters
- :integer (Integer): None
- :int32 (Integer): None
- :int64 (Integer): None
- :float (Float): None
- :string (String): None
- :binary (String): None
- :date (DateTime): None
- :date_time (DateTime): None
- :password (String): None
- :callback (String): None
- :integer (integer()): None
- :int32 (integer()): None
- :int64 (integer()): None
- :float (float()): None
- :string (String.t): None
- :binary (binary()): None
- :date (Date.t): None
- :date_time (DateTime.t): None
- :password (String.t): None
- :callback (String.t): None
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec test_endpoint_parameters(Tesla.Env.client, float(), float(), String.t, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
@spec test_endpoint_parameters(Tesla.Env.client, float(), float(), String.t, binary(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def test_endpoint_parameters(connection, number, double, pattern_without_delimiter, byte, opts \\ []) do
optional_params = %{
:"integer" => :form,
@ -212,14 +212,14 @@ defmodule SwaggerPetstore.Api.Fake do
- connection (SwaggerPetstore.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :enum_form_string_array (List[String]): Form parameter enum test (string array)
- :enum_form_string (String): Form parameter enum test (string)
- :enum_header_string_array (List[String]): Header parameter enum test (string array)
- :enum_header_string (String): Header parameter enum test (string)
- :enum_query_string_array (List[String]): Query parameter enum test (string array)
- :enum_query_string (String): Query parameter enum test (string)
- :enum_query_integer (Integer): Query parameter enum test (double)
- :enum_query_double (Float): Query parameter enum test (double)
- :enum_form_string_array ([String.t]): Form parameter enum test (string array)
- :enum_form_string (String.t): Form parameter enum test (string)
- :enum_header_string_array ([String.t]): Header parameter enum test (string array)
- :enum_header_string (String.t): Header parameter enum test (string)
- :enum_query_string_array ([String.t]): Query parameter enum test (string array)
- :enum_query_string (String.t): Query parameter enum test (string)
- :enum_query_integer (integer()): Query parameter enum test (double)
- :enum_query_double (float()): Query parameter enum test (double)
## Returns
@ -254,8 +254,8 @@ defmodule SwaggerPetstore.Api.Fake do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- param (String): field1
- param2 (String): field2
- param (String.t): field1
- param2 (String.t): field2
- opts (KeywordList): [optional] Optional parameters
## Returns

View File

@ -44,9 +44,9 @@ defmodule SwaggerPetstore.Api.Pet do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- pet_id (Integer): Pet id to delete
- pet_id (integer()): Pet id to delete
- opts (KeywordList): [optional] Optional parameters
- :api_key (String):
- :api_key (String.t):
## Returns
@ -74,7 +74,7 @@ defmodule SwaggerPetstore.Api.Pet do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- status (List[String]): Status values that need to be considered for filter
- status ([String.t]): Status values that need to be considered for filter
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -100,7 +100,7 @@ defmodule SwaggerPetstore.Api.Pet do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- tags (List[String]): Tags to filter by
- tags ([String.t]): Tags to filter by
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -126,7 +126,7 @@ defmodule SwaggerPetstore.Api.Pet do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- pet_id (Integer): ID of pet to return
- pet_id (integer()): ID of pet to return
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -177,10 +177,10 @@ defmodule SwaggerPetstore.Api.Pet do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- pet_id (Integer): ID of pet that needs to be updated
- pet_id (integer()): ID of pet that needs to be updated
- opts (KeywordList): [optional] Optional parameters
- :name (String): Updated name of the pet
- :status (String): Updated status of the pet
- :name (String.t): Updated name of the pet
- :status (String.t): Updated status of the pet
## Returns
@ -209,10 +209,10 @@ defmodule SwaggerPetstore.Api.Pet do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- pet_id (Integer): ID of pet to update
- pet_id (integer()): ID of pet to update
- opts (KeywordList): [optional] Optional parameters
- :additional_metadata (String): Additional data to pass to server
- :file (String): file to upload
- :additional_metadata (String.t): Additional data to pass to server
- :file (String.t): file to upload
## Returns

View File

@ -18,7 +18,7 @@ defmodule SwaggerPetstore.Api.Store do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- order_id (String): ID of the order that needs to be deleted
- order_id (String.t): ID of the order that needs to be deleted
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -67,7 +67,7 @@ defmodule SwaggerPetstore.Api.Store do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- order_id (Integer): ID of pet that needs to be fetched
- order_id (integer()): ID of pet that needs to be fetched
- opts (KeywordList): [optional] Optional parameters
## Returns

View File

@ -44,7 +44,7 @@ defmodule SwaggerPetstore.Api.User do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- body (List[User]): List of user object
- body ([User]): List of user object
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -70,7 +70,7 @@ defmodule SwaggerPetstore.Api.User do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- body (List[User]): List of user object
- body ([User]): List of user object
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -96,7 +96,7 @@ defmodule SwaggerPetstore.Api.User do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- username (String): The name that needs to be deleted
- username (String.t): The name that needs to be deleted
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -121,7 +121,7 @@ defmodule SwaggerPetstore.Api.User do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- username (String): The name that needs to be fetched. Use user1 for testing.
- username (String.t): The name that needs to be fetched. Use user1 for testing.
- opts (KeywordList): [optional] Optional parameters
## Returns
@ -146,13 +146,13 @@ defmodule SwaggerPetstore.Api.User do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- username (String): The user name for login
- password (String): The password for login in clear text
- username (String.t): The user name for login
- password (String.t): The password for login in clear text
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %SwaggerPetstore.Model.String{}} on success
{:ok, %SwaggerPetstore.Model.String.t{}} on success
{:error, info} on failure
"""
@spec login_user(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, String.t} | {:error, Tesla.Env.t}
@ -198,7 +198,7 @@ defmodule SwaggerPetstore.Api.User do
## Parameters
- connection (SwaggerPetstore.Connection): Connection to server
- username (String): name that need to be deleted
- username (String.t): name that need to be deleted
- body (User): Updated user object
- opts (KeywordList): [optional] Optional parameters

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.AdditionalPropertiesClass do
:"map_property",
:"map_of_map_property"
]
@type t :: %__MODULE__{
:"map_property" => %{optional(String.t) => String.t},
:"map_of_map_property" => %{optional(String.t) => %{optional(String.t) => String.t}}
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.AdditionalPropertiesClass do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.Animal do
:"className",
:"color"
]
@type t :: %__MODULE__{
:"className" => String.t,
:"color" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Animal do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.AnimalFarm do
defstruct [
]
@type t :: %__MODULE__{
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.AnimalFarm do

View File

@ -13,6 +13,12 @@ defmodule SwaggerPetstore.Model.ApiResponse do
:"type",
:"message"
]
@type t :: %__MODULE__{
:"code" => integer(),
:"type" => String.t,
:"message" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.ApiResponse do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.ArrayOfArrayOfNumberOnly do
defstruct [
:"ArrayArrayNumber"
]
@type t :: %__MODULE__{
:"ArrayArrayNumber" => [[float()]]
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.ArrayOfArrayOfNumberOnly do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.ArrayOfNumberOnly do
defstruct [
:"ArrayNumber"
]
@type t :: %__MODULE__{
:"ArrayNumber" => [float()]
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.ArrayOfNumberOnly do

View File

@ -13,6 +13,12 @@ defmodule SwaggerPetstore.Model.ArrayTest do
:"array_array_of_integer",
:"array_array_of_model"
]
@type t :: %__MODULE__{
:"array_of_string" => [String.t],
:"array_array_of_integer" => [[integer()]],
:"array_array_of_model" => [[ReadOnlyFirst]]
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.ArrayTest do

View File

@ -16,6 +16,15 @@ defmodule SwaggerPetstore.Model.Capitalization do
:"SCA_ETH_Flow_Points",
:"ATT_NAME"
]
@type t :: %__MODULE__{
:"smallCamel" => String.t,
:"CapitalCamel" => String.t,
:"small_Snake" => String.t,
:"Capital_Snake" => String.t,
:"SCA_ETH_Flow_Points" => String.t,
:"ATT_NAME" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Capitalization do

View File

@ -13,6 +13,12 @@ defmodule SwaggerPetstore.Model.Cat do
:"color",
:"declawed"
]
@type t :: %__MODULE__{
:"className" => String.t,
:"color" => String.t,
:"declawed" => boolean()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Cat do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.Category do
:"id",
:"name"
]
@type t :: %__MODULE__{
:"id" => integer(),
:"name" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Category do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.ClassModel do
defstruct [
:"_class"
]
@type t :: %__MODULE__{
:"_class" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.ClassModel do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.Client do
defstruct [
:"client"
]
@type t :: %__MODULE__{
:"client" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Client do

View File

@ -13,6 +13,12 @@ defmodule SwaggerPetstore.Model.Dog do
:"color",
:"breed"
]
@type t :: %__MODULE__{
:"className" => String.t,
:"color" => String.t,
:"breed" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Dog do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.EnumArrays do
:"just_symbol",
:"array_enum"
]
@type t :: %__MODULE__{
:"just_symbol" => String.t,
:"array_enum" => [String.t]
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.EnumArrays do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.EnumClass do
defstruct [
]
@type t :: %__MODULE__{
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.EnumClass do

View File

@ -14,6 +14,13 @@ defmodule SwaggerPetstore.Model.EnumTest do
:"enum_number",
:"outerEnum"
]
@type t :: %__MODULE__{
:"enum_string" => String.t,
:"enum_integer" => integer(),
:"enum_number" => float(),
:"outerEnum" => OuterEnum
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.EnumTest do

View File

@ -23,6 +23,22 @@ defmodule SwaggerPetstore.Model.FormatTest do
:"uuid",
:"password"
]
@type t :: %__MODULE__{
:"integer" => integer(),
:"int32" => integer(),
:"int64" => integer(),
:"number" => float(),
:"float" => float(),
:"double" => float(),
:"string" => String.t,
:"byte" => binary(),
:"binary" => binary(),
:"date" => Date.t,
:"dateTime" => DateTime.t,
:"uuid" => String.t,
:"password" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.FormatTest do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.HasOnlyReadOnly do
:"bar",
:"foo"
]
@type t :: %__MODULE__{
:"bar" => String.t,
:"foo" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.HasOnlyReadOnly do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.MapTest do
:"map_map_of_string",
:"map_of_enum_string"
]
@type t :: %__MODULE__{
:"map_map_of_string" => %{optional(String.t) => %{optional(String.t) => String.t}},
:"map_of_enum_string" => %{optional(String.t) => String.t}
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.MapTest do

View File

@ -13,6 +13,12 @@ defmodule SwaggerPetstore.Model.MixedPropertiesAndAdditionalPropertiesClass do
:"dateTime",
:"map"
]
@type t :: %__MODULE__{
:"uuid" => String.t,
:"dateTime" => DateTime.t,
:"map" => %{optional(String.t) => Animal}
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.MixedPropertiesAndAdditionalPropertiesClass do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.Model200Response do
:"name",
:"class"
]
@type t :: %__MODULE__{
:"name" => integer(),
:"class" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Model200Response do

View File

@ -14,6 +14,13 @@ defmodule SwaggerPetstore.Model.Name do
:"property",
:"123Number"
]
@type t :: %__MODULE__{
:"name" => integer(),
:"snake_case" => integer(),
:"property" => String.t,
:"123Number" => integer()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Name do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.NumberOnly do
defstruct [
:"JustNumber"
]
@type t :: %__MODULE__{
:"JustNumber" => float()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.NumberOnly do

View File

@ -16,6 +16,15 @@ defmodule SwaggerPetstore.Model.Order do
:"status",
:"complete"
]
@type t :: %__MODULE__{
:"id" => integer(),
:"petId" => integer(),
:"quantity" => integer(),
:"shipDate" => DateTime.t,
:"status" => String.t,
:"complete" => boolean()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Order do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.OuterBoolean do
defstruct [
]
@type t :: %__MODULE__{
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.OuterBoolean do

View File

@ -13,6 +13,12 @@ defmodule SwaggerPetstore.Model.OuterComposite do
:"my_string",
:"my_boolean"
]
@type t :: %__MODULE__{
:"my_number" => OuterNumber,
:"my_string" => OuterString,
:"my_boolean" => OuterBoolean
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.OuterComposite do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.OuterEnum do
defstruct [
]
@type t :: %__MODULE__{
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.OuterEnum do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.OuterNumber do
defstruct [
]
@type t :: %__MODULE__{
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.OuterNumber do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.OuterString do
defstruct [
]
@type t :: %__MODULE__{
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.OuterString do

View File

@ -16,6 +16,15 @@ defmodule SwaggerPetstore.Model.Pet do
:"tags",
:"status"
]
@type t :: %__MODULE__{
:"id" => integer(),
:"category" => Category,
:"name" => String.t,
:"photoUrls" => [String.t],
:"tags" => [Tag],
:"status" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Pet do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.ReadOnlyFirst do
:"bar",
:"baz"
]
@type t :: %__MODULE__{
:"bar" => String.t,
:"baz" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.ReadOnlyFirst do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.Return do
defstruct [
:"return"
]
@type t :: %__MODULE__{
:"return" => integer()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Return do

View File

@ -11,6 +11,10 @@ defmodule SwaggerPetstore.Model.SpecialModelName do
defstruct [
:"$special[property.name]"
]
@type t :: %__MODULE__{
:"$special[property.name]" => integer()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.SpecialModelName do

View File

@ -12,6 +12,11 @@ defmodule SwaggerPetstore.Model.Tag do
:"id",
:"name"
]
@type t :: %__MODULE__{
:"id" => integer(),
:"name" => String.t
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.Tag do

View File

@ -18,6 +18,17 @@ defmodule SwaggerPetstore.Model.User do
:"phone",
:"userStatus"
]
@type t :: %__MODULE__{
:"id" => integer(),
:"username" => String.t,
:"firstName" => String.t,
:"lastName" => String.t,
:"email" => String.t,
:"password" => String.t,
:"phone" => String.t,
:"userStatus" => integer()
}
end
defimpl Poison.Decoder, for: SwaggerPetstore.Model.User do