forked from loafle/openapi-generator-original
Improved Elixir Code Generation (#12751)
* Bump the minimum version of Elixir supported
The previous minimum version of Elixir is several years EOL.
The current minimum version of Elixir is also EOL, but is the minimum
version required to support some upcoming changes to the config
templates.
* Bump the minimum version fo Tesla
Keep the dependencies up to date
* Add a default .formatter.exs
* Add two Elixir-specific mustache lambdas
- The `atom` lambda results in the proper quoting of an atom depending
on the safe contents of the atom text, per the Elixir language
specification. That is, `{{#atom}}foo{{/atom}}` will be turned into
`:foo` and `{{#atom}foo.bar{{/atom}}` will be turned into
`:"foo.bar"`.
- The `env_var` lambda results in the treatment of the identifier
provided being capitalized as an environment variable would be.
`{{#env_var}}apiVersion{{/env_var}}` would become `ENV_VAR`.
* Use modern Elixir configuration
- This includes runtime configuration
- It depends on the `env_var` lambda.
* Fix a Language Server Warning
This change is *optional*, but removes a LS warning that was raised.
* Regenerated openapi_petstore for Elixir
* Add ex_doc as a default dependency
Fixes #12484
* Refine the regular expression for atoms
The original regex incorrectly matched `123Number` (unquoted atoms
cannot begin with numbers) and would incorrectly quote atoms ending in
`?` or `!`. Through testing with `iex`, it also turns out that the atom
`:-` is legal.
The following atoms will now not be quoted that would have been
incorrectly quoted:
- `:-`
- `:declawed?`
- `:neutered!`
The following atoms will be quoted that were incorrectly unquoted:
- `:"123Number"`
* Improve regex (again), remove files not generated
- The previous commit resulted in a number of warnings that were still
present and so I played with the regular expression. This did not
solve the problem, but the resulting regular expression is *much*
better than the previous one, so I'm keeping it.
- The problem was that the configuration (`bin/configs/elixir.yaml`) is
generated using a 3.0 input spec:
```yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
```
Which means that there were 16 files committed which were no longer
being generated. When I tested with the 2.0 input spec:
```yaml
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
```
The files were generated again. I *believe* that the correct change
here is to switch back to the 2.0 input spec, as it tests more code
generation, but I wanted to check in before I did this.
The following files are deleted:
- `elixir/lib/openapi_petstore/model/additional_properties_any_type.ex`
- `elixir/lib/openapi_petstore/model/additional_properties_array.ex`
- `elixir/lib/openapi_petstore/model/additional_properties_boolean.ex`
- `elixir/lib/openapi_petstore/model/additional_properties_integer.ex`
- `elixir/lib/openapi_petstore/model/additional_properties_number.ex`
- `elixir/lib/openapi_petstore/model/additional_properties_object.ex`
- `elixir/lib/openapi_petstore/model/additional_properties_string.ex`
- `elixir/lib/openapi_petstore/model/big_cat.ex`
- `elixir/lib/openapi_petstore/model/big_cat_all_of.ex`
- `elixir/lib/openapi_petstore/model/inline_response_default.ex`
- `elixir/lib/openapi_petstore/model/special_model_name.ex`
- `elixir/lib/openapi_petstore/model/type_holder_default.ex`
- `elixir/lib/openapi_petstore/model/type_holder_example.ex`
- `elixir/lib/openapi_petstore/model/xml_item.ex`
- `elixir/pom.xml`
- `elixir/test/pet_test.exs`
In the interim, I have removed those files from the commit.
This commit is contained in:
@@ -44,9 +44,11 @@ import java.util.regex.Pattern;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public class ElixirClientCodegen extends DefaultCodegen {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(ElixirClientCodegen.class);
|
||||
|
||||
private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_@\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-)\\z");
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected String moduleName;
|
||||
protected static final String defaultModuleName = "OpenAPI.Client";
|
||||
@@ -54,11 +56,12 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
// This is the name of elixir project name;
|
||||
protected static final String defaultPackageName = "openapi_client";
|
||||
|
||||
String supportedElixirVersion = "1.6";
|
||||
String supportedElixirVersion = "1.10";
|
||||
List<String> extraApplications = Arrays.asList(":logger");
|
||||
List<String> deps = Arrays.asList(
|
||||
"{:tesla, \"~> 1.2\"}",
|
||||
"{:poison, \"~> 3.0\"}"
|
||||
"{:tesla, \"~> 1.4\"}",
|
||||
"{:poison, \"~> 3.0\"}",
|
||||
"{:ex_doc, \"~> 0.28\", only: :dev, runtime: false}"
|
||||
);
|
||||
|
||||
public ElixirClientCodegen() {
|
||||
@@ -150,10 +153,18 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
"config",
|
||||
"config.exs")
|
||||
);
|
||||
supportingFiles.add(new SupportingFile("runtime.exs.mustache",
|
||||
"config",
|
||||
"runtime.exs")
|
||||
);
|
||||
supportingFiles.add(new SupportingFile("mix.exs.mustache",
|
||||
"",
|
||||
"mix.exs")
|
||||
);
|
||||
supportingFiles.add(new SupportingFile("formatter.exs",
|
||||
"",
|
||||
".formatter.exs")
|
||||
);
|
||||
supportingFiles.add(new SupportingFile("test_helper.exs.mustache",
|
||||
"test",
|
||||
"test_helper.exs")
|
||||
@@ -262,6 +273,19 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
writer.write(modulized(fragment.execute()));
|
||||
}
|
||||
});
|
||||
additionalProperties.put("atom", new Mustache.Lambda() {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
writer.write(atomized(fragment.execute()));
|
||||
}
|
||||
});
|
||||
additionalProperties.put("env_var", new Mustache.Lambda() {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
String text = underscored(fragment.execute());
|
||||
writer.write(text.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
});
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
setModuleName((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
@@ -377,6 +401,26 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return join("", modulizedWords);
|
||||
}
|
||||
|
||||
private String atomized(String text) {
|
||||
StringBuilder atom = new StringBuilder();
|
||||
Matcher m = simpleAtomPattern.matcher(text);
|
||||
|
||||
atom.append(":");
|
||||
|
||||
if (!m.matches()) {
|
||||
atom.append("\"");
|
||||
}
|
||||
|
||||
atom.append(text);
|
||||
|
||||
if (!m.matches()) {
|
||||
atom.append("\"");
|
||||
}
|
||||
|
||||
return atom.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
|
||||
* those terms here. This logic is only called if a variable matches the reserved words
|
||||
|
||||
@@ -48,7 +48,7 @@ defmodule {{moduleName}}.Api.{{classname}} do
|
||||
:body => :body
|
||||
{{/isBodyParam}}
|
||||
{{^isBodyParam}}
|
||||
:"{{baseName}}" => {{#isFormParam}}:form{{/isFormParam}}{{#isQueryParam}}:query{{/isQueryParam}}{{#isHeaderParam}}:headers{{/isHeaderParam}}{{^-last}},{{/-last}}
|
||||
{{#atom}}{{baseName}}{{/atom}} => {{#isFormParam}}:form{{/isFormParam}}{{#isQueryParam}}:query{{/isQueryParam}}{{#isHeaderParam}}:headers{{/isHeaderParam}}{{^-last}},{{/-last}}
|
||||
{{/isBodyParam}}
|
||||
{{#-last}}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ defmodule {{moduleName}}.Api.{{classname}} do
|
||||
|> url("{{replacedPathName}}")
|
||||
{{#requiredParams}}
|
||||
{{^isPathParam}}
|
||||
|> add_param({{#isBodyParam}}:body{{/isBodyParam}}{{#isFormParam}}{{#isMultipart}}{{#isFile}}:file{{/isFile}}{{^isFile}}:form{{/isFile}}{{/isMultipart}}{{^isMultipart}}:form{{/isMultipart}}{{/isFormParam}}{{#isQueryParam}}:query{{/isQueryParam}}{{#isHeaderParam}}:headers{{/isHeaderParam}}, {{#isBodyParam}}:body, {{/isBodyParam}}{{^isBodyParam}}:"{{baseName}}", {{/isBodyParam}}{{#underscored}}{{paramName}}{{/underscored}})
|
||||
|> add_param({{#isBodyParam}}:body{{/isBodyParam}}{{#isFormParam}}{{#isMultipart}}{{#isFile}}:file{{/isFile}}{{^isFile}}:form{{/isFile}}{{/isMultipart}}{{^isMultipart}}:form{{/isMultipart}}{{/isFormParam}}{{#isQueryParam}}:query{{/isQueryParam}}{{#isHeaderParam}}:headers{{/isHeaderParam}}, {{#isBodyParam}}:body, {{/isBodyParam}}{{^isBodyParam}}{{#atom}}{{baseName}}{{/atom}}, {{/isBodyParam}}{{#underscored}}{{paramName}}{{/underscored}})
|
||||
{{/isPathParam}}
|
||||
{{/requiredParams}}
|
||||
{{#optionalParams}}
|
||||
|
||||
@@ -1,32 +1,15 @@
|
||||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
# and its dependencies with the aid of the Config module.
|
||||
#
|
||||
# This configuration file is loaded before any dependency and
|
||||
# is restricted to this project.
|
||||
|
||||
# This configuration is loaded before any dependency and is restricted
|
||||
# to this project. If another project depends on this project, this
|
||||
# file won't be loaded nor affect the parent project. For this reason,
|
||||
# if you want to provide default values for your application for
|
||||
# 3rd-party users, it should be done in your "mix.exs" file.
|
||||
|
||||
# You can configure for your application as:
|
||||
#
|
||||
# config :{{#underscored}}{{appName}}{{/underscored}}, key: :value
|
||||
#
|
||||
# And access this configuration in your application as:
|
||||
#
|
||||
# Application.get_env(:{{#underscored}}{{appName}}{{/underscored}}, :key)
|
||||
#
|
||||
# Or configure a 3rd-party app:
|
||||
#
|
||||
# config :logger, level: :info
|
||||
#
|
||||
# General application configuration
|
||||
import Config
|
||||
|
||||
config :{{#underscored}}{{appName}}{{/underscored}}, base_url: "{{{basePath}}}"
|
||||
|
||||
# It is also possible to import configuration files, relative to this
|
||||
# directory. For example, you can emulate configuration per environment
|
||||
# by uncommenting the line below and defining dev.exs, test.exs and such.
|
||||
# Configuration from the imported file will override the ones defined
|
||||
# here (which is why it is important to import them last).
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
# of this file so it overrides the configuration defined above.
|
||||
#
|
||||
# import_config "#{Mix.env}.exs"
|
||||
# import_config "#{config_env()}.exs"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[
|
||||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
|
||||
]
|
||||
@@ -40,7 +40,7 @@ defmodule {{moduleName}}.Mixfile do
|
||||
defp package() do
|
||||
[
|
||||
name: "{{#underscored}}{{packageName}}{{/underscored}}",
|
||||
files: ~w(lib mix.exs README* LICENSE*),
|
||||
files: ~w(.formatter.exs config lib mix.exs README* LICENSE*),
|
||||
licenses: ["{{licenseId}}"]
|
||||
]
|
||||
end
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
{{#vars}}:"{{&baseName}}"{{^-last}},
|
||||
{{#vars}}{{#atom}}{{&baseName}}{{/atom}}{{^-last}},
|
||||
{{/-last}}{{/vars}}
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
{{#vars}}:"{{&baseName}}" => {{{datatype}}}{{#isNullable}} | nil{{/isNullable}}{{^isNullable}}{{^required}} | nil{{/required}}{{/isNullable}}{{^-last}},
|
||||
{{#vars}}{{#atom}}{{&baseName}}{{/atom}} => {{{datatype}}}{{#isNullable}} | nil{{/isNullable}}{{^isNullable}}{{^required}} | nil{{/required}}{{/isNullable}}{{^-last}},
|
||||
{{/-last}}{{/vars}}
|
||||
}
|
||||
end
|
||||
@@ -23,7 +23,7 @@ defimpl Poison.Decoder, for: {{&moduleName}}.Model.{{&classname}} do
|
||||
value
|
||||
{{#vars}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#baseType}}|> deserialize(:"{{&baseName}}", {{#isArray}}:list, {{&moduleName}}.Model.{{{items.baseType}}}{{/isArray}}{{#isMap}}:map, {{&moduleName}}.Model.{{{items.baseType}}}{{/isMap}}{{#isDate}}:date, nil{{/isDate}}{{#isDateTime}}:date, nil{{/isDateTime}}{{^isDate}}{{^isDateTime}}{{^isMap}}{{^isArray}}:struct, {{moduleName}}.Model.{{baseType}}{{/isArray}}{{/isMap}}{{/isDateTime}}{{/isDate}}, options)
|
||||
{{#baseType}}|> deserialize({{#atom}}{{&baseName}}{{/atom}}, {{#isArray}}:list, {{&moduleName}}.Model.{{{items.baseType}}}{{/isArray}}{{#isMap}}:map, {{&moduleName}}.Model.{{{items.baseType}}}{{/isMap}}{{#isDate}}:date, nil{{/isDate}}{{#isDateTime}}:date, nil{{/isDateTime}}{{^isDate}}{{^isDateTime}}{{^isMap}}{{^isArray}}:struct, {{moduleName}}.Model.{{baseType}}{{/isArray}}{{/isMap}}{{/isDateTime}}{{/isDate}}, options)
|
||||
{{/baseType}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
|
||||
12
modules/openapi-generator/src/main/resources/elixir/runtime.exs.mustache
vendored
Normal file
12
modules/openapi-generator/src/main/resources/elixir/runtime.exs.mustache
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import Config
|
||||
|
||||
# config/runtime.exs is executed for all environments, including
|
||||
# during releases. It is executed after compilation and before the
|
||||
# system starts, so it is typically used to load production configuration
|
||||
# and secrets from environment variables or elsewhere. Do not define
|
||||
# any compile-time configuration in here, as it won't be applied.
|
||||
# The block below contains prod specific runtime configuration.
|
||||
|
||||
if env = System.get_env("{{#env_var}}{{appName}}{{/env_var}}_BASE_URI") do
|
||||
config :{{#underscored}}{{appName}}{{/underscored}}, base_url: env
|
||||
end
|
||||
3
samples/client/petstore/elixir/.formatter.exs
Normal file
3
samples/client/petstore/elixir/.formatter.exs
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
|
||||
]
|
||||
@@ -1,6 +1,9 @@
|
||||
.formatter.exs
|
||||
.gitignore
|
||||
.openapi-generator-ignore
|
||||
README.md
|
||||
config/config.exs
|
||||
config/runtime.exs
|
||||
lib/openapi_petstore/api/another_fake.ex
|
||||
lib/openapi_petstore/api/default.ex
|
||||
lib/openapi_petstore/api/fake.ex
|
||||
|
||||
@@ -1,32 +1,15 @@
|
||||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
# and its dependencies with the aid of the Config module.
|
||||
#
|
||||
# This configuration file is loaded before any dependency and
|
||||
# is restricted to this project.
|
||||
|
||||
# This configuration is loaded before any dependency and is restricted
|
||||
# to this project. If another project depends on this project, this
|
||||
# file won't be loaded nor affect the parent project. For this reason,
|
||||
# if you want to provide default values for your application for
|
||||
# 3rd-party users, it should be done in your "mix.exs" file.
|
||||
|
||||
# You can configure for your application as:
|
||||
#
|
||||
# config :open_api_petstore, key: :value
|
||||
#
|
||||
# And access this configuration in your application as:
|
||||
#
|
||||
# Application.get_env(:open_api_petstore, :key)
|
||||
#
|
||||
# Or configure a 3rd-party app:
|
||||
#
|
||||
# config :logger, level: :info
|
||||
#
|
||||
# General application configuration
|
||||
import Config
|
||||
|
||||
config :open_api_petstore, base_url: "http://petstore.swagger.io:80/v2"
|
||||
|
||||
# It is also possible to import configuration files, relative to this
|
||||
# directory. For example, you can emulate configuration per environment
|
||||
# by uncommenting the line below and defining dev.exs, test.exs and such.
|
||||
# Configuration from the imported file will override the ones defined
|
||||
# here (which is why it is important to import them last).
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
# of this file so it overrides the configuration defined above.
|
||||
#
|
||||
# import_config "#{Mix.env}.exs"
|
||||
# import_config "#{config_env()}.exs"
|
||||
|
||||
12
samples/client/petstore/elixir/config/runtime.exs
Normal file
12
samples/client/petstore/elixir/config/runtime.exs
Normal file
@@ -0,0 +1,12 @@
|
||||
import Config
|
||||
|
||||
# config/runtime.exs is executed for all environments, including
|
||||
# during releases. It is executed after compilation and before the
|
||||
# system starts, so it is typically used to load production configuration
|
||||
# and secrets from environment variables or elsewhere. Do not define
|
||||
# any compile-time configuration in here, as it won't be applied.
|
||||
# The block below contains prod specific runtime configuration.
|
||||
|
||||
if env = System.get_env("OPEN_API_PETSTORE_BASE_URI") do
|
||||
config :open_api_petstore, base_url: env
|
||||
end
|
||||
@@ -53,8 +53,8 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
@spec fake_http_signature_test(Tesla.Env.client, OpenapiPetstore.Model.Pet.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
|
||||
def fake_http_signature_test(connection, pet, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"query_1" => :query,
|
||||
:"header_1" => :headers
|
||||
:query_1 => :query,
|
||||
:header_1 => :headers
|
||||
}
|
||||
%{}
|
||||
|> method(:get)
|
||||
@@ -284,7 +284,7 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
%{}
|
||||
|> method(:put)
|
||||
|> url("/fake/body-with-query-params")
|
||||
|> add_param(:query, :"query", query)
|
||||
|> add_param(:query, :query, query)
|
||||
|> add_param(:body, :body, user)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
@@ -350,24 +350,24 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
@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,
|
||||
:"int32" => :form,
|
||||
:"int64" => :form,
|
||||
:"float" => :form,
|
||||
:"string" => :form,
|
||||
:"binary" => :form,
|
||||
:"date" => :form,
|
||||
:"dateTime" => :form,
|
||||
:"password" => :form,
|
||||
:"callback" => :form
|
||||
:integer => :form,
|
||||
:int32 => :form,
|
||||
:int64 => :form,
|
||||
:float => :form,
|
||||
:string => :form,
|
||||
:binary => :form,
|
||||
:date => :form,
|
||||
:dateTime => :form,
|
||||
:password => :form,
|
||||
:callback => :form
|
||||
}
|
||||
%{}
|
||||
|> method(:post)
|
||||
|> url("/fake")
|
||||
|> add_param(:form, :"number", number)
|
||||
|> add_param(:form, :"double", double)
|
||||
|> add_param(:form, :"pattern_without_delimiter", pattern_without_delimiter)
|
||||
|> add_param(:form, :"byte", byte)
|
||||
|> add_param(:form, :number, number)
|
||||
|> add_param(:form, :double, double)
|
||||
|> add_param(:form, :pattern_without_delimiter, pattern_without_delimiter)
|
||||
|> add_param(:form, :byte, byte)
|
||||
|> add_optional_params(optional_params, opts)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
@@ -402,15 +402,15 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
@spec test_enum_parameters(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
|
||||
def test_enum_parameters(connection, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"enum_header_string_array" => :headers,
|
||||
:"enum_header_string" => :headers,
|
||||
:"enum_query_string_array" => :query,
|
||||
:"enum_query_string" => :query,
|
||||
:"enum_query_integer" => :query,
|
||||
:"enum_query_double" => :query,
|
||||
:"enum_query_model_array" => :query,
|
||||
:"enum_form_string_array" => :form,
|
||||
:"enum_form_string" => :form
|
||||
:enum_header_string_array => :headers,
|
||||
:enum_header_string => :headers,
|
||||
:enum_query_string_array => :query,
|
||||
:enum_query_string => :query,
|
||||
:enum_query_integer => :query,
|
||||
:enum_query_double => :query,
|
||||
:enum_query_model_array => :query,
|
||||
:enum_form_string_array => :form,
|
||||
:enum_form_string => :form
|
||||
}
|
||||
%{}
|
||||
|> method(:get)
|
||||
@@ -446,16 +446,16 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
@spec test_group_parameters(Tesla.Env.client, integer(), boolean(), integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
|
||||
def test_group_parameters(connection, required_string_group, required_boolean_group, required_int64_group, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"string_group" => :query,
|
||||
:"boolean_group" => :headers,
|
||||
:"int64_group" => :query
|
||||
:string_group => :query,
|
||||
:boolean_group => :headers,
|
||||
:int64_group => :query
|
||||
}
|
||||
%{}
|
||||
|> method(:delete)
|
||||
|> url("/fake")
|
||||
|> add_param(:query, :"required_string_group", required_string_group)
|
||||
|> add_param(:headers, :"required_boolean_group", required_boolean_group)
|
||||
|> add_param(:query, :"required_int64_group", required_int64_group)
|
||||
|> add_param(:query, :required_string_group, required_string_group)
|
||||
|> add_param(:headers, :required_boolean_group, required_boolean_group)
|
||||
|> add_param(:query, :required_int64_group, required_int64_group)
|
||||
|> add_optional_params(optional_params, opts)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
@@ -511,8 +511,8 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
%{}
|
||||
|> method(:get)
|
||||
|> url("/fake/jsonFormData")
|
||||
|> add_param(:form, :"param", param)
|
||||
|> add_param(:form, :"param2", param2)
|
||||
|> add_param(:form, :param, param)
|
||||
|> add_param(:form, :param2, param2)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
|> evaluate_response([
|
||||
@@ -542,17 +542,17 @@ defmodule OpenapiPetstore.Api.Fake do
|
||||
@spec test_query_parameter_collection_format(Tesla.Env.client, list(String.t), list(String.t), list(String.t), list(String.t), list(String.t), String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
|
||||
def test_query_parameter_collection_format(connection, pipe, ioutil, http, url, context, allow_empty, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"language" => :query
|
||||
:language => :query
|
||||
}
|
||||
%{}
|
||||
|> method(:put)
|
||||
|> url("/fake/test-query-parameters")
|
||||
|> add_param(:query, :"pipe", pipe)
|
||||
|> add_param(:query, :"ioutil", ioutil)
|
||||
|> add_param(:query, :"http", http)
|
||||
|> add_param(:query, :"url", url)
|
||||
|> add_param(:query, :"context", context)
|
||||
|> add_param(:query, :"allowEmpty", allow_empty)
|
||||
|> add_param(:query, :pipe, pipe)
|
||||
|> add_param(:query, :ioutil, ioutil)
|
||||
|> add_param(:query, :http, http)
|
||||
|> add_param(:query, :url, url)
|
||||
|> add_param(:query, :context, context)
|
||||
|> add_param(:query, :allowEmpty, allow_empty)
|
||||
|> add_optional_params(optional_params, opts)
|
||||
|> ensure_body()
|
||||
|> Enum.into([])
|
||||
|
||||
@@ -57,7 +57,7 @@ defmodule OpenapiPetstore.Api.Pet do
|
||||
@spec delete_pet(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
|
||||
def delete_pet(connection, pet_id, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"api_key" => :headers
|
||||
:api_key => :headers
|
||||
}
|
||||
%{}
|
||||
|> method(:delete)
|
||||
@@ -90,7 +90,7 @@ defmodule OpenapiPetstore.Api.Pet do
|
||||
%{}
|
||||
|> method(:get)
|
||||
|> url("/pet/findByStatus")
|
||||
|> add_param(:query, :"status", status)
|
||||
|> add_param(:query, :status, status)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
|> evaluate_response([
|
||||
@@ -118,7 +118,7 @@ defmodule OpenapiPetstore.Api.Pet do
|
||||
%{}
|
||||
|> method(:get)
|
||||
|> url("/pet/findByTags")
|
||||
|> add_param(:query, :"tags", tags)
|
||||
|> add_param(:query, :tags, tags)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
|> evaluate_response([
|
||||
@@ -204,8 +204,8 @@ defmodule OpenapiPetstore.Api.Pet do
|
||||
@spec update_pet_with_form(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
|
||||
def update_pet_with_form(connection, pet_id, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"name" => :form,
|
||||
:"status" => :form
|
||||
:name => :form,
|
||||
:status => :form
|
||||
}
|
||||
%{}
|
||||
|> method(:post)
|
||||
@@ -239,8 +239,8 @@ defmodule OpenapiPetstore.Api.Pet do
|
||||
@spec upload_file(Tesla.Env.client, integer(), keyword()) :: {:ok, OpenapiPetstore.Model.ApiResponse.t} | {:error, Tesla.Env.t}
|
||||
def upload_file(connection, pet_id, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"additionalMetadata" => :form,
|
||||
:"file" => :form
|
||||
:additionalMetadata => :form,
|
||||
:file => :form
|
||||
}
|
||||
%{}
|
||||
|> method(:post)
|
||||
@@ -273,12 +273,12 @@ defmodule OpenapiPetstore.Api.Pet do
|
||||
@spec upload_file_with_required_file(Tesla.Env.client, integer(), String.t, keyword()) :: {:ok, OpenapiPetstore.Model.ApiResponse.t} | {:error, Tesla.Env.t}
|
||||
def upload_file_with_required_file(connection, pet_id, required_file, opts \\ []) do
|
||||
optional_params = %{
|
||||
:"additionalMetadata" => :form
|
||||
:additionalMetadata => :form
|
||||
}
|
||||
%{}
|
||||
|> method(:post)
|
||||
|> url("/fake/#{pet_id}/uploadImageWithRequiredFile")
|
||||
|> add_param(:file, :"requiredFile", required_file)
|
||||
|> add_param(:file, :requiredFile, required_file)
|
||||
|> add_optional_params(optional_params, opts)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
|
||||
@@ -167,8 +167,8 @@ defmodule OpenapiPetstore.Api.User do
|
||||
%{}
|
||||
|> method(:get)
|
||||
|> url("/user/login")
|
||||
|> add_param(:query, :"username", username)
|
||||
|> add_param(:query, :"password", password)
|
||||
|> add_param(:query, :username, username)
|
||||
|> add_param(:query, :password, password)
|
||||
|> Enum.into([])
|
||||
|> (&Connection.request(connection, &1)).()
|
||||
|> evaluate_response([
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.FooGetDefaultResponse do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"string"
|
||||
:string
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"string" => OpenapiPetstore.Model.Foo.t | nil
|
||||
:string => OpenapiPetstore.Model.Foo.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.FooGetDefaultResponse do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"string", :struct, OpenapiPetstore.Model.Foo, options)
|
||||
|> deserialize(:string, :struct, OpenapiPetstore.Model.Foo, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesAnyType do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesAnyType do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesArray do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesArray do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesBoolean do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesBoolean do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.AdditionalPropertiesClass do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"map_property",
|
||||
:"map_of_map_property"
|
||||
:map_property,
|
||||
:map_of_map_property
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"map_property" => %{optional(String.t) => String.t} | nil,
|
||||
:"map_of_map_property" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil
|
||||
:map_property => %{optional(String.t) => String.t} | nil,
|
||||
:map_of_map_property => %{optional(String.t) => %{optional(String.t) => String.t}} | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesInteger do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesInteger do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesNumber do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesNumber do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesObject do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesObject do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.AdditionalPropertiesString do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AdditionalPropertiesString do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.AllOfWithSingleRef do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"username",
|
||||
:"SingleRefType"
|
||||
:username,
|
||||
:SingleRefType
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"username" => String.t | nil,
|
||||
:"SingleRefType" => SingleRefType | nil
|
||||
:username => String.t | nil,
|
||||
:SingleRefType => SingleRefType | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.AllOfWithSingleRef do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"SingleRefType", :struct, OpenapiPetstore.Model.SingleRefType, options)
|
||||
|> deserialize(:SingleRefType, :struct, OpenapiPetstore.Model.SingleRefType, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.Animal do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"className",
|
||||
:"color"
|
||||
:className,
|
||||
:color
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"className" => String.t,
|
||||
:"color" => String.t | nil
|
||||
:className => String.t,
|
||||
:color => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ defmodule OpenapiPetstore.Model.ApiResponse do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"code",
|
||||
:"type",
|
||||
:"message"
|
||||
:code,
|
||||
:type,
|
||||
:message
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"code" => integer() | nil,
|
||||
:"type" => String.t | nil,
|
||||
:"message" => String.t | nil
|
||||
:code => integer() | nil,
|
||||
:type => String.t | nil,
|
||||
:message => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.ArrayOfArrayOfNumberOnly do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"ArrayArrayNumber"
|
||||
:ArrayArrayNumber
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"ArrayArrayNumber" => [[float()]] | nil
|
||||
:ArrayArrayNumber => [[float()]] | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.ArrayOfNumberOnly do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"ArrayNumber"
|
||||
:ArrayNumber
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"ArrayNumber" => [float()] | nil
|
||||
:ArrayNumber => [float()] | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ defmodule OpenapiPetstore.Model.ArrayTest do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"array_of_string",
|
||||
:"array_array_of_integer",
|
||||
:"array_array_of_model"
|
||||
:array_of_string,
|
||||
:array_array_of_integer,
|
||||
:array_array_of_model
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"array_of_string" => [String.t] | nil,
|
||||
:"array_array_of_integer" => [[integer()]] | nil,
|
||||
:"array_array_of_model" => [[OpenapiPetstore.Model.ReadOnlyFirst.t]] | nil
|
||||
:array_of_string => [String.t] | nil,
|
||||
:array_array_of_integer => [[integer()]] | nil,
|
||||
:array_array_of_model => [[OpenapiPetstore.Model.ReadOnlyFirst.t]] | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.BigCat do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"className",
|
||||
:"color",
|
||||
:"declawed",
|
||||
:"kind"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"className" => String.t,
|
||||
:"color" => String.t | nil,
|
||||
:"declawed" => boolean() | nil,
|
||||
:"kind" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.BigCat do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.BigCatAllOf do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"kind"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"kind" => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.BigCatAllOf do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,21 +9,21 @@ defmodule OpenapiPetstore.Model.Capitalization do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"smallCamel",
|
||||
:"CapitalCamel",
|
||||
:"small_Snake",
|
||||
:"Capital_Snake",
|
||||
:"SCA_ETH_Flow_Points",
|
||||
:"ATT_NAME"
|
||||
:smallCamel,
|
||||
:CapitalCamel,
|
||||
:small_Snake,
|
||||
:Capital_Snake,
|
||||
:SCA_ETH_Flow_Points,
|
||||
:ATT_NAME
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"smallCamel" => String.t | nil,
|
||||
:"CapitalCamel" => String.t | nil,
|
||||
:"small_Snake" => String.t | nil,
|
||||
:"Capital_Snake" => String.t | nil,
|
||||
:"SCA_ETH_Flow_Points" => String.t | nil,
|
||||
:"ATT_NAME" => String.t | nil
|
||||
:smallCamel => String.t | nil,
|
||||
:CapitalCamel => String.t | nil,
|
||||
:small_Snake => String.t | nil,
|
||||
:Capital_Snake => String.t | nil,
|
||||
:SCA_ETH_Flow_Points => String.t | nil,
|
||||
:ATT_NAME => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ defmodule OpenapiPetstore.Model.Cat do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"className",
|
||||
:"color",
|
||||
:"declawed"
|
||||
:className,
|
||||
:color,
|
||||
:declawed
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"className" => String.t,
|
||||
:"color" => String.t | nil,
|
||||
:"declawed" => boolean() | nil
|
||||
:className => String.t,
|
||||
:color => String.t | nil,
|
||||
:declawed => boolean() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.CatAllOf do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"declawed"
|
||||
:declawed
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"declawed" => boolean() | nil
|
||||
:declawed => boolean() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.Category do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"id",
|
||||
:"name"
|
||||
:id,
|
||||
:name
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"id" => integer() | nil,
|
||||
:"name" => String.t
|
||||
:id => integer() | nil,
|
||||
:name => String.t
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.ClassModel do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"_class"
|
||||
:_class
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"_class" => String.t | nil
|
||||
:_class => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.Client do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"client"
|
||||
:client
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"client" => String.t | nil
|
||||
:client => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.DeprecatedObject do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name"
|
||||
:name
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => String.t | nil
|
||||
:name => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ defmodule OpenapiPetstore.Model.Dog do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"className",
|
||||
:"color",
|
||||
:"breed"
|
||||
:className,
|
||||
:color,
|
||||
:breed
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"className" => String.t,
|
||||
:"color" => String.t | nil,
|
||||
:"breed" => String.t | nil
|
||||
:className => String.t,
|
||||
:color => String.t | nil,
|
||||
:breed => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.DogAllOf do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"breed"
|
||||
:breed
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"breed" => String.t | nil
|
||||
:breed => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.EnumArrays do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"just_symbol",
|
||||
:"array_enum"
|
||||
:just_symbol,
|
||||
:array_enum
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"just_symbol" => String.t | nil,
|
||||
:"array_enum" => [String.t] | nil
|
||||
:just_symbol => String.t | nil,
|
||||
:array_enum => [String.t] | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,25 +9,25 @@ defmodule OpenapiPetstore.Model.EnumTest do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"enum_string",
|
||||
:"enum_string_required",
|
||||
:"enum_integer",
|
||||
:"enum_number",
|
||||
:"outerEnum",
|
||||
:"outerEnumInteger",
|
||||
:"outerEnumDefaultValue",
|
||||
:"outerEnumIntegerDefaultValue"
|
||||
:enum_string,
|
||||
:enum_string_required,
|
||||
:enum_integer,
|
||||
:enum_number,
|
||||
:outerEnum,
|
||||
:outerEnumInteger,
|
||||
:outerEnumDefaultValue,
|
||||
:outerEnumIntegerDefaultValue
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"enum_string" => String.t | nil,
|
||||
:"enum_string_required" => String.t,
|
||||
:"enum_integer" => integer() | nil,
|
||||
:"enum_number" => float() | nil,
|
||||
:"outerEnum" => OpenapiPetstore.Model.OuterEnum.t | nil,
|
||||
:"outerEnumInteger" => OpenapiPetstore.Model.OuterEnumInteger.t | nil,
|
||||
:"outerEnumDefaultValue" => OpenapiPetstore.Model.OuterEnumDefaultValue.t | nil,
|
||||
:"outerEnumIntegerDefaultValue" => OpenapiPetstore.Model.OuterEnumIntegerDefaultValue.t | nil
|
||||
:enum_string => String.t | nil,
|
||||
:enum_string_required => String.t,
|
||||
:enum_integer => integer() | nil,
|
||||
:enum_number => float() | nil,
|
||||
:outerEnum => OpenapiPetstore.Model.OuterEnum.t | nil,
|
||||
:outerEnumInteger => OpenapiPetstore.Model.OuterEnumInteger.t | nil,
|
||||
:outerEnumDefaultValue => OpenapiPetstore.Model.OuterEnumDefaultValue.t | nil,
|
||||
:outerEnumIntegerDefaultValue => OpenapiPetstore.Model.OuterEnumIntegerDefaultValue.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -35,10 +35,10 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.EnumTest do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"outerEnum", :struct, OpenapiPetstore.Model.OuterEnum, options)
|
||||
|> deserialize(:"outerEnumInteger", :struct, OpenapiPetstore.Model.OuterEnumInteger, options)
|
||||
|> deserialize(:"outerEnumDefaultValue", :struct, OpenapiPetstore.Model.OuterEnumDefaultValue, options)
|
||||
|> deserialize(:"outerEnumIntegerDefaultValue", :struct, OpenapiPetstore.Model.OuterEnumIntegerDefaultValue, options)
|
||||
|> deserialize(:outerEnum, :struct, OpenapiPetstore.Model.OuterEnum, options)
|
||||
|> deserialize(:outerEnumInteger, :struct, OpenapiPetstore.Model.OuterEnumInteger, options)
|
||||
|> deserialize(:outerEnumDefaultValue, :struct, OpenapiPetstore.Model.OuterEnumDefaultValue, options)
|
||||
|> deserialize(:outerEnumIntegerDefaultValue, :struct, OpenapiPetstore.Model.OuterEnumIntegerDefaultValue, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.File do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"sourceURI"
|
||||
:sourceURI
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"sourceURI" => String.t | nil
|
||||
:sourceURI => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.FileSchemaTestClass do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"file",
|
||||
:"files"
|
||||
:file,
|
||||
:files
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"file" => OpenapiPetstore.Model.File.t | nil,
|
||||
:"files" => [OpenapiPetstore.Model.File.t] | nil
|
||||
:file => OpenapiPetstore.Model.File.t | nil,
|
||||
:files => [OpenapiPetstore.Model.File.t] | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -23,8 +23,8 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.FileSchemaTestClass do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"file", :struct, OpenapiPetstore.Model.File, options)
|
||||
|> deserialize(:"files", :list, OpenapiPetstore.Model.File, options)
|
||||
|> deserialize(:file, :struct, OpenapiPetstore.Model.File, options)
|
||||
|> deserialize(:files, :list, OpenapiPetstore.Model.File, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.Foo do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"bar"
|
||||
:bar
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"bar" => String.t | nil
|
||||
:bar => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,41 +9,41 @@ defmodule OpenapiPetstore.Model.FormatTest do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"integer",
|
||||
:"int32",
|
||||
:"int64",
|
||||
:"number",
|
||||
:"float",
|
||||
:"double",
|
||||
:"decimal",
|
||||
:"string",
|
||||
:"byte",
|
||||
:"binary",
|
||||
:"date",
|
||||
:"dateTime",
|
||||
:"uuid",
|
||||
:"password",
|
||||
:"pattern_with_digits",
|
||||
:"pattern_with_digits_and_delimiter"
|
||||
:integer,
|
||||
:int32,
|
||||
:int64,
|
||||
:number,
|
||||
:float,
|
||||
:double,
|
||||
:decimal,
|
||||
:string,
|
||||
:byte,
|
||||
:binary,
|
||||
:date,
|
||||
:dateTime,
|
||||
:uuid,
|
||||
:password,
|
||||
:pattern_with_digits,
|
||||
:pattern_with_digits_and_delimiter
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"integer" => integer() | nil,
|
||||
:"int32" => integer() | nil,
|
||||
:"int64" => integer() | nil,
|
||||
:"number" => float(),
|
||||
:"float" => float() | nil,
|
||||
:"double" => float() | nil,
|
||||
:"decimal" => String.t | nil,
|
||||
:"string" => String.t | nil,
|
||||
:"byte" => binary(),
|
||||
:"binary" => String.t | nil,
|
||||
:"date" => Date.t,
|
||||
:"dateTime" => DateTime.t | nil,
|
||||
:"uuid" => String.t | nil,
|
||||
:"password" => String.t,
|
||||
:"pattern_with_digits" => String.t | nil,
|
||||
:"pattern_with_digits_and_delimiter" => String.t | nil
|
||||
:integer => integer() | nil,
|
||||
:int32 => integer() | nil,
|
||||
:int64 => integer() | nil,
|
||||
:number => float(),
|
||||
:float => float() | nil,
|
||||
:double => float() | nil,
|
||||
:decimal => String.t | nil,
|
||||
:string => String.t | nil,
|
||||
:byte => binary(),
|
||||
:binary => String.t | nil,
|
||||
:date => Date.t,
|
||||
:dateTime => DateTime.t | nil,
|
||||
:uuid => String.t | nil,
|
||||
:password => String.t,
|
||||
:pattern_with_digits => String.t | nil,
|
||||
:pattern_with_digits_and_delimiter => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.FormatTest do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"date", :date, nil, options)
|
||||
|> deserialize(:date, :date, nil, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.HasOnlyReadOnly do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"bar",
|
||||
:"foo"
|
||||
:bar,
|
||||
:foo
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"bar" => String.t | nil,
|
||||
:"foo" => String.t | nil
|
||||
:bar => String.t | nil,
|
||||
:foo => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.HealthCheckResult do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"NullableMessage"
|
||||
:NullableMessage
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"NullableMessage" => String.t | nil
|
||||
:NullableMessage => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.InlineResponseDefault do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"string"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"string" => OpenapiPetstore.Model.Foo.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.InlineResponseDefault do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"string", :struct, OpenapiPetstore.Model.Foo, options)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,17 +9,17 @@ defmodule OpenapiPetstore.Model.MapTest do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"map_map_of_string",
|
||||
:"map_of_enum_string",
|
||||
:"direct_map",
|
||||
:"indirect_map"
|
||||
:map_map_of_string,
|
||||
:map_of_enum_string,
|
||||
:direct_map,
|
||||
:indirect_map
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"map_map_of_string" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil,
|
||||
:"map_of_enum_string" => %{optional(String.t) => String.t} | nil,
|
||||
:"direct_map" => %{optional(String.t) => boolean()} | nil,
|
||||
:"indirect_map" => %{optional(String.t) => boolean()} | nil
|
||||
:map_map_of_string => %{optional(String.t) => %{optional(String.t) => String.t}} | nil,
|
||||
:map_of_enum_string => %{optional(String.t) => String.t} | nil,
|
||||
:direct_map => %{optional(String.t) => boolean()} | nil,
|
||||
:indirect_map => %{optional(String.t) => boolean()} | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ defmodule OpenapiPetstore.Model.MixedPropertiesAndAdditionalPropertiesClass do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"uuid",
|
||||
:"dateTime",
|
||||
:"map"
|
||||
:uuid,
|
||||
:dateTime,
|
||||
:map
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"uuid" => String.t | nil,
|
||||
:"dateTime" => DateTime.t | nil,
|
||||
:"map" => %{optional(String.t) => OpenapiPetstore.Model.Animal.t} | nil
|
||||
:uuid => String.t | nil,
|
||||
:dateTime => DateTime.t | nil,
|
||||
:map => %{optional(String.t) => OpenapiPetstore.Model.Animal.t} | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.MixedPropertiesAndAdditionalP
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"map", :map, OpenapiPetstore.Model.Animal, options)
|
||||
|> deserialize(:map, :map, OpenapiPetstore.Model.Animal, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.Model200Response do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name",
|
||||
:"class"
|
||||
:name,
|
||||
:class
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => integer() | nil,
|
||||
:"class" => String.t | nil
|
||||
:name => integer() | nil,
|
||||
:class => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ defmodule OpenapiPetstore.Model.Name do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"name",
|
||||
:"snake_case",
|
||||
:"property",
|
||||
:name,
|
||||
:snake_case,
|
||||
:property,
|
||||
:"123Number"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"name" => integer(),
|
||||
:"snake_case" => integer() | nil,
|
||||
:"property" => String.t | nil,
|
||||
:name => integer(),
|
||||
:snake_case => integer() | nil,
|
||||
:property => String.t | nil,
|
||||
:"123Number" => integer() | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -9,33 +9,33 @@ defmodule OpenapiPetstore.Model.NullableClass do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"integer_prop",
|
||||
:"number_prop",
|
||||
:"boolean_prop",
|
||||
:"string_prop",
|
||||
:"date_prop",
|
||||
:"datetime_prop",
|
||||
:"array_nullable_prop",
|
||||
:"array_and_items_nullable_prop",
|
||||
:"array_items_nullable",
|
||||
:"object_nullable_prop",
|
||||
:"object_and_items_nullable_prop",
|
||||
:"object_items_nullable"
|
||||
:integer_prop,
|
||||
:number_prop,
|
||||
:boolean_prop,
|
||||
:string_prop,
|
||||
:date_prop,
|
||||
:datetime_prop,
|
||||
:array_nullable_prop,
|
||||
:array_and_items_nullable_prop,
|
||||
:array_items_nullable,
|
||||
:object_nullable_prop,
|
||||
:object_and_items_nullable_prop,
|
||||
:object_items_nullable
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"integer_prop" => integer() | nil,
|
||||
:"number_prop" => float() | nil,
|
||||
:"boolean_prop" => boolean() | nil,
|
||||
:"string_prop" => String.t | nil,
|
||||
:"date_prop" => Date.t | nil,
|
||||
:"datetime_prop" => DateTime.t | nil,
|
||||
:"array_nullable_prop" => [map()] | nil,
|
||||
:"array_and_items_nullable_prop" => [map()] | nil,
|
||||
:"array_items_nullable" => [map()] | nil,
|
||||
:"object_nullable_prop" => %{optional(String.t) => map()} | nil,
|
||||
:"object_and_items_nullable_prop" => %{optional(String.t) => map()} | nil,
|
||||
:"object_items_nullable" => %{optional(String.t) => map()} | nil
|
||||
:integer_prop => integer() | nil,
|
||||
:number_prop => float() | nil,
|
||||
:boolean_prop => boolean() | nil,
|
||||
:string_prop => String.t | nil,
|
||||
:date_prop => Date.t | nil,
|
||||
:datetime_prop => DateTime.t | nil,
|
||||
:array_nullable_prop => [map()] | nil,
|
||||
:array_and_items_nullable_prop => [map()] | nil,
|
||||
:array_items_nullable => [map()] | nil,
|
||||
:object_nullable_prop => %{optional(String.t) => map()} | nil,
|
||||
:object_and_items_nullable_prop => %{optional(String.t) => map()} | nil,
|
||||
:object_items_nullable => %{optional(String.t) => map()} | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.NullableClass do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"date_prop", :date, nil, options)
|
||||
|> deserialize(:date_prop, :date, nil, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.NumberOnly do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"JustNumber"
|
||||
:JustNumber
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"JustNumber" => float() | nil
|
||||
:JustNumber => float() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ defmodule OpenapiPetstore.Model.ObjectWithDeprecatedFields do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"uuid",
|
||||
:"id",
|
||||
:"deprecatedRef",
|
||||
:"bars"
|
||||
:uuid,
|
||||
:id,
|
||||
:deprecatedRef,
|
||||
:bars
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"uuid" => String.t | nil,
|
||||
:"id" => float() | nil,
|
||||
:"deprecatedRef" => OpenapiPetstore.Model.DeprecatedObject.t | nil,
|
||||
:"bars" => [OpenapiPetstore.Model.String.t] | nil
|
||||
:uuid => String.t | nil,
|
||||
:id => float() | nil,
|
||||
:deprecatedRef => OpenapiPetstore.Model.DeprecatedObject.t | nil,
|
||||
:bars => [OpenapiPetstore.Model.String.t] | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.ObjectWithDeprecatedFields do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"deprecatedRef", :struct, OpenapiPetstore.Model.DeprecatedObject, options)
|
||||
|> deserialize(:deprecatedRef, :struct, OpenapiPetstore.Model.DeprecatedObject, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,21 +9,21 @@ defmodule OpenapiPetstore.Model.Order do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"id",
|
||||
:"petId",
|
||||
:"quantity",
|
||||
:"shipDate",
|
||||
:"status",
|
||||
:"complete"
|
||||
:id,
|
||||
:petId,
|
||||
:quantity,
|
||||
:shipDate,
|
||||
:status,
|
||||
:complete
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"id" => integer() | nil,
|
||||
:"petId" => integer() | nil,
|
||||
:"quantity" => integer() | nil,
|
||||
:"shipDate" => DateTime.t | nil,
|
||||
:"status" => String.t | nil,
|
||||
:"complete" => boolean() | nil
|
||||
:id => integer() | nil,
|
||||
:petId => integer() | nil,
|
||||
:quantity => integer() | nil,
|
||||
:shipDate => DateTime.t | nil,
|
||||
:status => String.t | nil,
|
||||
:complete => boolean() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ defmodule OpenapiPetstore.Model.OuterComposite do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"my_number",
|
||||
:"my_string",
|
||||
:"my_boolean"
|
||||
:my_number,
|
||||
:my_string,
|
||||
:my_boolean
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"my_number" => float() | nil,
|
||||
:"my_string" => String.t | nil,
|
||||
:"my_boolean" => boolean() | nil
|
||||
:my_number => float() | nil,
|
||||
:my_string => String.t | nil,
|
||||
:my_boolean => boolean() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.OuterObjectWithEnumProperty do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"value"
|
||||
:value
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"value" => OpenapiPetstore.Model.OuterEnumInteger.t
|
||||
:value => OpenapiPetstore.Model.OuterEnumInteger.t
|
||||
}
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.OuterObjectWithEnumProperty d
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"value", :struct, OpenapiPetstore.Model.OuterEnumInteger, options)
|
||||
|> deserialize(:value, :struct, OpenapiPetstore.Model.OuterEnumInteger, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,21 +9,21 @@ defmodule OpenapiPetstore.Model.Pet do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"id",
|
||||
:"category",
|
||||
:"name",
|
||||
:"photoUrls",
|
||||
:"tags",
|
||||
:"status"
|
||||
:id,
|
||||
:category,
|
||||
:name,
|
||||
:photoUrls,
|
||||
:tags,
|
||||
:status
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"id" => integer() | nil,
|
||||
:"category" => OpenapiPetstore.Model.Category.t | nil,
|
||||
:"name" => String.t,
|
||||
:"photoUrls" => [String.t],
|
||||
:"tags" => [OpenapiPetstore.Model.Tag.t] | nil,
|
||||
:"status" => String.t | nil
|
||||
:id => integer() | nil,
|
||||
:category => OpenapiPetstore.Model.Category.t | nil,
|
||||
:name => String.t,
|
||||
:photoUrls => [String.t],
|
||||
:tags => [OpenapiPetstore.Model.Tag.t] | nil,
|
||||
:status => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
@@ -31,8 +31,8 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.Pet do
|
||||
import OpenapiPetstore.Deserializer
|
||||
def decode(value, options) do
|
||||
value
|
||||
|> deserialize(:"category", :struct, OpenapiPetstore.Model.Category, options)
|
||||
|> deserialize(:"tags", :list, OpenapiPetstore.Model.Tag, options)
|
||||
|> deserialize(:category, :struct, OpenapiPetstore.Model.Category, options)
|
||||
|> deserialize(:tags, :list, OpenapiPetstore.Model.Tag, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.ReadOnlyFirst do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"bar",
|
||||
:"baz"
|
||||
:bar,
|
||||
:baz
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"bar" => String.t | nil,
|
||||
:"baz" => String.t | nil
|
||||
:bar => String.t | nil,
|
||||
:baz => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ defmodule OpenapiPetstore.Model.Return do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"return"
|
||||
:return
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"return" => integer() | nil
|
||||
:return => integer() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.SpecialModelName do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"$special[property.name]"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"$special[property.name]" => integer() | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.SpecialModelName do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,13 +9,13 @@ defmodule OpenapiPetstore.Model.Tag do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"id",
|
||||
:"name"
|
||||
:id,
|
||||
:name
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"id" => integer() | nil,
|
||||
:"name" => String.t | nil
|
||||
:id => integer() | nil,
|
||||
:name => String.t | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.TypeHolderDefault do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"string_item",
|
||||
:"number_item",
|
||||
:"integer_item",
|
||||
:"bool_item",
|
||||
:"array_item"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"string_item" => String.t,
|
||||
:"number_item" => float(),
|
||||
:"integer_item" => integer(),
|
||||
:"bool_item" => boolean(),
|
||||
:"array_item" => [integer()]
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.TypeHolderDefault do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.TypeHolderExample do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"string_item",
|
||||
:"number_item",
|
||||
:"float_item",
|
||||
:"integer_item",
|
||||
:"bool_item",
|
||||
:"array_item"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"string_item" => String.t,
|
||||
:"number_item" => float(),
|
||||
:"float_item" => float(),
|
||||
:"integer_item" => integer(),
|
||||
:"bool_item" => boolean(),
|
||||
:"array_item" => [integer()]
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.TypeHolderExample do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,25 +9,25 @@ defmodule OpenapiPetstore.Model.User do
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"id",
|
||||
:"username",
|
||||
:"firstName",
|
||||
:"lastName",
|
||||
:"email",
|
||||
:"password",
|
||||
:"phone",
|
||||
:"userStatus"
|
||||
:id,
|
||||
:username,
|
||||
:firstName,
|
||||
:lastName,
|
||||
:email,
|
||||
:password,
|
||||
:phone,
|
||||
:userStatus
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"id" => integer() | nil,
|
||||
:"username" => String.t | nil,
|
||||
:"firstName" => String.t | nil,
|
||||
:"lastName" => String.t | nil,
|
||||
:"email" => String.t | nil,
|
||||
:"password" => String.t | nil,
|
||||
:"phone" => String.t | nil,
|
||||
:"userStatus" => integer() | nil
|
||||
:id => integer() | nil,
|
||||
:username => String.t | nil,
|
||||
:firstName => String.t | nil,
|
||||
:lastName => String.t | nil,
|
||||
:email => String.t | nil,
|
||||
:password => String.t | nil,
|
||||
:phone => String.t | nil,
|
||||
:userStatus => integer() | nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
# https://openapi-generator.tech
|
||||
# Do not edit the class manually.
|
||||
|
||||
defmodule OpenapiPetstore.Model.XmlItem do
|
||||
@moduledoc """
|
||||
|
||||
"""
|
||||
|
||||
@derive [Poison.Encoder]
|
||||
defstruct [
|
||||
:"attribute_string",
|
||||
:"attribute_number",
|
||||
:"attribute_integer",
|
||||
:"attribute_boolean",
|
||||
:"wrapped_array",
|
||||
:"name_string",
|
||||
:"name_number",
|
||||
:"name_integer",
|
||||
:"name_boolean",
|
||||
:"name_array",
|
||||
:"name_wrapped_array",
|
||||
:"prefix_string",
|
||||
:"prefix_number",
|
||||
:"prefix_integer",
|
||||
:"prefix_boolean",
|
||||
:"prefix_array",
|
||||
:"prefix_wrapped_array",
|
||||
:"namespace_string",
|
||||
:"namespace_number",
|
||||
:"namespace_integer",
|
||||
:"namespace_boolean",
|
||||
:"namespace_array",
|
||||
:"namespace_wrapped_array",
|
||||
:"prefix_ns_string",
|
||||
:"prefix_ns_number",
|
||||
:"prefix_ns_integer",
|
||||
:"prefix_ns_boolean",
|
||||
:"prefix_ns_array",
|
||||
:"prefix_ns_wrapped_array"
|
||||
]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
:"attribute_string" => String.t | nil,
|
||||
:"attribute_number" => float() | nil,
|
||||
:"attribute_integer" => integer() | nil,
|
||||
:"attribute_boolean" => boolean() | nil,
|
||||
:"wrapped_array" => [integer()] | nil,
|
||||
:"name_string" => String.t | nil,
|
||||
:"name_number" => float() | nil,
|
||||
:"name_integer" => integer() | nil,
|
||||
:"name_boolean" => boolean() | nil,
|
||||
:"name_array" => [integer()] | nil,
|
||||
:"name_wrapped_array" => [integer()] | nil,
|
||||
:"prefix_string" => String.t | nil,
|
||||
:"prefix_number" => float() | nil,
|
||||
:"prefix_integer" => integer() | nil,
|
||||
:"prefix_boolean" => boolean() | nil,
|
||||
:"prefix_array" => [integer()] | nil,
|
||||
:"prefix_wrapped_array" => [integer()] | nil,
|
||||
:"namespace_string" => String.t | nil,
|
||||
:"namespace_number" => float() | nil,
|
||||
:"namespace_integer" => integer() | nil,
|
||||
:"namespace_boolean" => boolean() | nil,
|
||||
:"namespace_array" => [integer()] | nil,
|
||||
:"namespace_wrapped_array" => [integer()] | nil,
|
||||
:"prefix_ns_string" => String.t | nil,
|
||||
:"prefix_ns_number" => float() | nil,
|
||||
:"prefix_ns_integer" => integer() | nil,
|
||||
:"prefix_ns_boolean" => boolean() | nil,
|
||||
:"prefix_ns_array" => [integer()] | nil,
|
||||
:"prefix_ns_wrapped_array" => [integer()] | nil
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Poison.Decoder, for: OpenapiPetstore.Model.XmlItem do
|
||||
def decode(value, _options) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ defmodule OpenapiPetstore.Mixfile do
|
||||
def project do
|
||||
[app: :openapi_petstore,
|
||||
version: "1.0.0",
|
||||
elixir: "~> 1.6",
|
||||
elixir: "~> 1.10",
|
||||
build_embedded: Mix.env == :prod,
|
||||
start_permanent: Mix.env == :prod,
|
||||
package: package(),
|
||||
@@ -31,15 +31,16 @@ defmodule OpenapiPetstore.Mixfile do
|
||||
# Type "mix help deps" for more examples and options
|
||||
defp deps do
|
||||
[
|
||||
{:tesla, "~> 1.2"},
|
||||
{:poison, "~> 3.0"}
|
||||
{:tesla, "~> 1.4"},
|
||||
{:poison, "~> 3.0"},
|
||||
{:ex_doc, "~> 0.28", only: :dev, runtime: false}
|
||||
]
|
||||
end
|
||||
|
||||
defp package() do
|
||||
[
|
||||
name: "openapi_petstore",
|
||||
files: ~w(lib mix.exs README* LICENSE*),
|
||||
files: ~w(.formatter.exs config lib mix.exs README* LICENSE*),
|
||||
licenses: [""]
|
||||
]
|
||||
end
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>ElixirPetstoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Elixir Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>dep-install</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>mix</executable>
|
||||
<arguments>
|
||||
<argument>local.hex</argument>
|
||||
<argument>--force</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>mix</executable>
|
||||
<arguments>
|
||||
<argument>do</argument>
|
||||
<argument>deps.get,</argument>
|
||||
<argument>compile</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>mix</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,60 +0,0 @@
|
||||
defmodule PetTest do
|
||||
use ExUnit.Case
|
||||
alias OpenapiPetstore.Connection
|
||||
alias OpenapiPetstore.Api.Pet, as: PetApi
|
||||
alias OpenapiPetstore.Model.Pet
|
||||
alias OpenapiPetstore.Model.Category
|
||||
alias OpenapiPetstore.Model.Tag
|
||||
|
||||
test "add and delete a pet" do
|
||||
petId = 10007
|
||||
pet = %Pet{
|
||||
:id => petId,
|
||||
:name => "elixir client test",
|
||||
:photoUrls => ["http://test_elixir_unit_test.com"],
|
||||
:category => %Category{:id => petId, :name=> "test elixir category"},
|
||||
:tags => [%Tag{:id => petId, :name => "test elixir tag"}],
|
||||
}
|
||||
{:ok, response} = PetApi.add_pet(Connection.new, pet)
|
||||
assert response.status == 200
|
||||
|
||||
{:ok, pet} = PetApi.get_pet_by_id(Connection.new, petId)
|
||||
assert pet.id == petId
|
||||
assert pet.name == "elixir client test"
|
||||
assert List.first(pet.photoUrls) == "http://test_elixir_unit_test.com"
|
||||
assert pet.category.id == petId
|
||||
assert pet.category.name == "test elixir category"
|
||||
assert List.first(pet.tags) == %Tag{:id => petId, :name => "test elixir tag"}
|
||||
|
||||
{:ok, response} = PetApi.delete_pet(Connection.new, petId)
|
||||
assert response.status == 200
|
||||
{:ok, response} = PetApi.get_pet_by_id(Connection.new, petId)
|
||||
assert response.status == 404
|
||||
end
|
||||
|
||||
test "update a pet" do
|
||||
petId = 10007
|
||||
pet = %Pet{
|
||||
:id => petId,
|
||||
:name => "elixir client updatePet",
|
||||
:status => "pending",
|
||||
:photoUrls => ["http://test_elixir_unit_test.com"]
|
||||
}
|
||||
{:ok, response} = PetApi.update_pet(Connection.new, pet)
|
||||
assert response.status == 200
|
||||
|
||||
{:ok, pet} = PetApi.get_pet_by_id(Connection.new, petId)
|
||||
assert pet.id == petId
|
||||
assert pet.name == "elixir client updatePet"
|
||||
assert pet.status == "pending"
|
||||
end
|
||||
|
||||
test "find pet by status" do
|
||||
{:ok, listPets} = PetApi.find_pets_by_status(Connection.new, "available")
|
||||
assert List.first(listPets) != nil
|
||||
|
||||
{:ok, listPets} = PetApi.find_pets_by_status(Connection.new, "unknown_and_incorrect_status")
|
||||
assert List.first(listPets) == nil
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user