Better inline model resolver to handle inline schema in array item (#12104)

* better support of inline schema in array item

* update tests

* update samples

* regenerate samples

* fix allof naming, remove files

* add files

* update samples

* update readme

* fix tests

* update samples

* update samples

* add new files

* update test spec

* add back tests

* remove unused files

* comment out python test

* update js test using own spec

* remove files

* remove unused files

* remove files

* remove unused files

* better handling of allOf with a single type

* comment out go test

* remove test_all_of_with_single_ref_single_ref_type.py

* fix inline resolver, uncomment go test
This commit is contained in:
William Cheng
2022-04-20 10:28:15 +08:00
committed by GitHub
parent 12454de3ac
commit 8330e16d66
200 changed files with 7495 additions and 975 deletions

View File

@@ -12,6 +12,7 @@ lib/openapi_petstore/connection.ex
lib/openapi_petstore/deserializer.ex
lib/openapi_petstore/model/_special_model_name_.ex
lib/openapi_petstore/model/additional_properties_class.ex
lib/openapi_petstore/model/all_of_with_single_ref.ex
lib/openapi_petstore/model/animal.ex
lib/openapi_petstore/model/api_response.ex
lib/openapi_petstore/model/array_of_array_of_number_only.ex
@@ -54,9 +55,9 @@ lib/openapi_petstore/model/outer_object_with_enum_property.ex
lib/openapi_petstore/model/pet.ex
lib/openapi_petstore/model/read_only_first.ex
lib/openapi_petstore/model/return.ex
lib/openapi_petstore/model/single_ref_type.ex
lib/openapi_petstore/model/tag.ex
lib/openapi_petstore/model/user.ex
lib/openapi_petstore/model/user_type.ex
lib/openapi_petstore/request_builder.ex
mix.exs
test/test_helper.exs

View File

@@ -0,0 +1,29 @@
# 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.AllOfWithSingleRef do
@moduledoc """
"""
@derive [Poison.Encoder]
defstruct [
:"username",
:"SingleRefType"
]
@type t :: %__MODULE__{
:"username" => String.t | nil,
:"SingleRefType" => SingleRefType | nil
}
end
defimpl Poison.Decoder, for: OpenapiPetstore.Model.AllOfWithSingleRef do
import OpenapiPetstore.Deserializer
def decode(value, options) do
value
|> deserialize(:"SingleRefType", :struct, OpenapiPetstore.Model.SingleRefType, options)
end
end

View File

@@ -2,7 +2,7 @@
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule OpenapiPetstore.Model.UserType do
defmodule OpenapiPetstore.Model.SingleRefType do
@moduledoc """
"""
@@ -17,7 +17,7 @@ defmodule OpenapiPetstore.Model.UserType do
}
end
defimpl Poison.Decoder, for: OpenapiPetstore.Model.UserType do
defimpl Poison.Decoder, for: OpenapiPetstore.Model.SingleRefType do
def decode(value, _options) do
value
end

View File

@@ -16,8 +16,7 @@ defmodule OpenapiPetstore.Model.User do
:"email",
:"password",
:"phone",
:"userStatus",
:"userType"
:"userStatus"
]
@type t :: %__MODULE__{
@@ -28,16 +27,13 @@ defmodule OpenapiPetstore.Model.User do
:"email" => String.t | nil,
:"password" => String.t | nil,
:"phone" => String.t | nil,
:"userStatus" => integer() | nil,
:"userType" => UserType | nil
:"userStatus" => integer() | nil
}
end
defimpl Poison.Decoder, for: OpenapiPetstore.Model.User do
import OpenapiPetstore.Deserializer
def decode(value, options) do
def decode(value, _options) do
value
|> deserialize(:"userType", :struct, OpenapiPetstore.Model.UserType, options)
end
end