diff --git a/Project.toml b/Project.toml
index e9cbf03..44be3cb 100644
--- a/Project.toml
+++ b/Project.toml
@@ -4,7 +4,7 @@ keywords = ["Swagger", "OpenAPI", "REST"]
license = "MIT"
desc = "OpenAPI server and client helper for Julia"
authors = ["JuliaHub Inc."]
-version = "0.1.17"
+version = "0.1.18"
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
diff --git a/src/client.jl b/src/client.jl
index 647ef27..c055ddd 100644
--- a/src/client.jl
+++ b/src/client.jl
@@ -711,6 +711,7 @@ convert(::Type{T}, v::Nothing) where {T<:APIModel} = T()
convert(::Type{T}, v::T) where {T<:OneOfAPIModel} = v
convert(::Type{T}, json::Dict{String,Any}) where {T<:OneOfAPIModel} = from_json(T, json)
convert(::Type{T}, v) where {T<:OneOfAPIModel} = T(v)
+convert(::Type{T}, v::String) where {T<:OneOfAPIModel} = T(v)
convert(::Type{T}, v::T) where {T<:AnyOfAPIModel} = v
convert(::Type{T}, json::Dict{String,Any}) where {T<:AnyOfAPIModel} = from_json(T, json)
convert(::Type{T}, v) where {T<:AnyOfAPIModel} = T(v)
diff --git a/src/json.jl b/src/json.jl
index 598c57d..43988e3 100644
--- a/src/json.jl
+++ b/src/json.jl
@@ -24,7 +24,15 @@ function iterate(w::JSONWrapper, state...)
end
lower(o::T) where {T<:APIModel} = JSONWrapper(o)
-lower(o::T) where {T<:UnionAPIModel} = typeof(o.value) <: APIModel ? JSONWrapper(o.value) : to_json(o.value)
+function lower(o::T) where {T<:UnionAPIModel}
+ if typeof(o.value) <: APIModel
+ return JSONWrapper(o.value)
+ elseif typeof(o.value) <: Union{String,Real}
+ return o.value
+ else
+ return to_json(o.value)
+ end
+end
to_json(o) = JSON.json(o)
@@ -38,6 +46,12 @@ function from_json(o::T, json::Dict{String,Any}) where {T <: UnionAPIModel}
return from_json(o, :value, json)
end
+from_json(::Type{T}, val::Union{String,Real}) where {T <: UnionAPIModel} = T(val)
+function from_json(o::T, val::Union{String,Real}) where {T <: UnionAPIModel}
+ o.value = val
+ return o
+end
+
function from_json(o::T, json::Dict{String,Any}) where {T <: APIModel}
jsonkeys = [Symbol(k) for k in keys(json)]
for name in intersect(propertynames(o), jsonkeys)
@@ -54,7 +68,7 @@ function from_json(o::T, name::Symbol, json::Dict{String,Any}) where {T <: APIMo
end
function from_json(o::T, name::Symbol, v) where {T <: APIModel}
- ftype = property_type(T, name)
+ ftype = (T <: UnionAPIModel) ? property_type(T, name, Dict{String,Any}()) : property_type(T, name)
if ftype === Any
setfield!(o, name, v)
elseif ZonedDateTime <: ftype
@@ -89,7 +103,13 @@ function from_json(o::T, name::Symbol, v::Vector) where {T <: APIModel}
setfield!(o, name, map(str2date, v))
else
if (vtype <: Vector) && (veltype <: OpenAPI.UnionAPIModel)
- setfield!(o, name, map(veltype, v))
+ vec = veltype[]
+ for vecelem in v
+ push!(vec, from_json(veltype(), :value, vecelem))
+ end
+ setfield!(o, name, vec)
+ elseif (vtype <: Vector) && (veltype <: OpenAPI.APIModel)
+ setfield!(o, name, map(x->convert(veltype,x), v))
elseif (vtype <: Vector) && (veltype <: String)
# ensure that elements are converted to String
# convert is to do the translation to Union{Nothing,String} when necessary
diff --git a/test/client/allany/AllAnyClient/.openapi-generator/FILES b/test/client/allany/AllAnyClient/.openapi-generator/FILES
index 4819799..47a1217 100644
--- a/test/client/allany/AllAnyClient/.openapi-generator/FILES
+++ b/test/client/allany/AllAnyClient/.openapi-generator/FILES
@@ -1,19 +1,25 @@
README.md
+docs/AnyOfBaseType.md
docs/AnyOfMappedPets.md
docs/AnyOfPets.md
docs/Cat.md
docs/DefaultApi.md
docs/Dog.md
+docs/OneOfBaseType.md
docs/OneOfMappedPets.md
docs/OneOfPets.md
docs/Pet.md
+docs/TypeWithAllArrayTypes.md
src/AllAnyClient.jl
src/apis/api_DefaultApi.jl
src/modelincludes.jl
+src/models/model_AnyOfBaseType.jl
src/models/model_AnyOfMappedPets.jl
src/models/model_AnyOfPets.jl
src/models/model_Cat.jl
src/models/model_Dog.jl
+src/models/model_OneOfBaseType.jl
src/models/model_OneOfMappedPets.jl
src/models/model_OneOfPets.jl
src/models/model_Pet.jl
+src/models/model_TypeWithAllArrayTypes.jl
diff --git a/test/client/allany/AllAnyClient/.openapi-generator/VERSION b/test/client/allany/AllAnyClient/.openapi-generator/VERSION
index 757e674..44bad91 100644
--- a/test/client/allany/AllAnyClient/.openapi-generator/VERSION
+++ b/test/client/allany/AllAnyClient/.openapi-generator/VERSION
@@ -1 +1 @@
-7.0.0-SNAPSHOT
\ No newline at end of file
+7.0.1-SNAPSHOT
\ No newline at end of file
diff --git a/test/client/allany/AllAnyClient/README.md b/test/client/allany/AllAnyClient/README.md
index 88961cb..878d7c8 100644
--- a/test/client/allany/AllAnyClient/README.md
+++ b/test/client/allany/AllAnyClient/README.md
@@ -20,21 +20,27 @@ Documentation is also embedded in Julia which can be used with a Julia specific
Class | Method
------------ | -------------
+*DefaultApi* | [**echo_anyof_base_type_post**](docs/DefaultApi.md#echo_anyof_base_type_post)
**POST** /echo_anyof_base_type
*DefaultApi* | [**echo_anyof_mapped_pets_post**](docs/DefaultApi.md#echo_anyof_mapped_pets_post)
**POST** /echo_anyof_mapped_pets
*DefaultApi* | [**echo_anyof_pets_post**](docs/DefaultApi.md#echo_anyof_pets_post)
**POST** /echo_anyof_pets
+*DefaultApi* | [**echo_arrays_post**](docs/DefaultApi.md#echo_arrays_post)
**POST** /echo_arrays
+*DefaultApi* | [**echo_oneof_base_type_post**](docs/DefaultApi.md#echo_oneof_base_type_post)
**POST** /echo_oneof_base_type
*DefaultApi* | [**echo_oneof_mapped_pets_post**](docs/DefaultApi.md#echo_oneof_mapped_pets_post)
**POST** /echo_oneof_mapped_pets
*DefaultApi* | [**echo_oneof_pets_post**](docs/DefaultApi.md#echo_oneof_pets_post)
**POST** /echo_oneof_pets
## Models
+ - [AnyOfBaseType](docs/AnyOfBaseType.md)
- [AnyOfMappedPets](docs/AnyOfMappedPets.md)
- [AnyOfPets](docs/AnyOfPets.md)
- [Cat](docs/Cat.md)
- [Dog](docs/Dog.md)
+ - [OneOfBaseType](docs/OneOfBaseType.md)
- [OneOfMappedPets](docs/OneOfMappedPets.md)
- [OneOfPets](docs/OneOfPets.md)
- [Pet](docs/Pet.md)
+ - [TypeWithAllArrayTypes](docs/TypeWithAllArrayTypes.md)
diff --git a/test/client/allany/AllAnyClient/docs/AnyOfBaseType.md b/test/client/allany/AllAnyClient/docs/AnyOfBaseType.md
new file mode 100644
index 0000000..f4e20a9
--- /dev/null
+++ b/test/client/allany/AllAnyClient/docs/AnyOfBaseType.md
@@ -0,0 +1,16 @@
+# AnyOfBaseType
+
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | This is a anyOf model. The value must be any of the following types: Float64, String | | [optional]
+
+
+
+
+
+[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/test/client/allany/AllAnyClient/docs/DefaultApi.md b/test/client/allany/AllAnyClient/docs/DefaultApi.md
index 904d4dc..b08b6ef 100644
--- a/test/client/allany/AllAnyClient/docs/DefaultApi.md
+++ b/test/client/allany/AllAnyClient/docs/DefaultApi.md
@@ -4,12 +4,43 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
+[**echo_anyof_base_type_post**](DefaultApi.md#echo_anyof_base_type_post) | **POST** /echo_anyof_base_type |
[**echo_anyof_mapped_pets_post**](DefaultApi.md#echo_anyof_mapped_pets_post) | **POST** /echo_anyof_mapped_pets |
[**echo_anyof_pets_post**](DefaultApi.md#echo_anyof_pets_post) | **POST** /echo_anyof_pets |
+[**echo_arrays_post**](DefaultApi.md#echo_arrays_post) | **POST** /echo_arrays |
+[**echo_oneof_base_type_post**](DefaultApi.md#echo_oneof_base_type_post) | **POST** /echo_oneof_base_type |
[**echo_oneof_mapped_pets_post**](DefaultApi.md#echo_oneof_mapped_pets_post) | **POST** /echo_oneof_mapped_pets |
[**echo_oneof_pets_post**](DefaultApi.md#echo_oneof_pets_post) | **POST** /echo_oneof_pets |
+# **echo_anyof_base_type_post**
+> echo_anyof_base_type_post(_api::DefaultApi, any_of_base_type::AnyOfBaseType; _mediaType=nothing) -> AnyOfBaseType, OpenAPI.Clients.ApiResponse
+> echo_anyof_base_type_post(_api::DefaultApi, response_stream::Channel, any_of_base_type::AnyOfBaseType; _mediaType=nothing) -> Channel{ AnyOfBaseType }, OpenAPI.Clients.ApiResponse
+
+
+
+### Required Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **_api** | **DefaultApi** | API context |
+**any_of_base_type** | [**AnyOfBaseType**](AnyOfBaseType.md)| |
+
+### Return type
+
+[**AnyOfBaseType**](AnyOfBaseType.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
+
# **echo_anyof_mapped_pets_post**
> echo_anyof_mapped_pets_post(_api::DefaultApi, any_of_mapped_pets::AnyOfMappedPets; _mediaType=nothing) -> AnyOfMappedPets, OpenAPI.Clients.ApiResponse
> echo_anyof_mapped_pets_post(_api::DefaultApi, response_stream::Channel, any_of_mapped_pets::AnyOfMappedPets; _mediaType=nothing) -> Channel{ AnyOfMappedPets }, OpenAPI.Clients.ApiResponse
@@ -66,6 +97,62 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
+# **echo_arrays_post**
+> echo_arrays_post(_api::DefaultApi, type_with_all_array_types::TypeWithAllArrayTypes; _mediaType=nothing) -> TypeWithAllArrayTypes, OpenAPI.Clients.ApiResponse
+> echo_arrays_post(_api::DefaultApi, response_stream::Channel, type_with_all_array_types::TypeWithAllArrayTypes; _mediaType=nothing) -> Channel{ TypeWithAllArrayTypes }, OpenAPI.Clients.ApiResponse
+
+
+
+### Required Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **_api** | **DefaultApi** | API context |
+**type_with_all_array_types** | [**TypeWithAllArrayTypes**](TypeWithAllArrayTypes.md)| |
+
+### Return type
+
+[**TypeWithAllArrayTypes**](TypeWithAllArrayTypes.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
+
+# **echo_oneof_base_type_post**
+> echo_oneof_base_type_post(_api::DefaultApi, one_of_base_type::OneOfBaseType; _mediaType=nothing) -> OneOfBaseType, OpenAPI.Clients.ApiResponse
+> echo_oneof_base_type_post(_api::DefaultApi, response_stream::Channel, one_of_base_type::OneOfBaseType; _mediaType=nothing) -> Channel{ OneOfBaseType }, OpenAPI.Clients.ApiResponse
+
+
+
+### Required Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **_api** | **DefaultApi** | API context |
+**one_of_base_type** | [**OneOfBaseType**](OneOfBaseType.md)| |
+
+### Return type
+
+[**OneOfBaseType**](OneOfBaseType.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
+
# **echo_oneof_mapped_pets_post**
> echo_oneof_mapped_pets_post(_api::DefaultApi, one_of_mapped_pets::OneOfMappedPets; _mediaType=nothing) -> OneOfMappedPets, OpenAPI.Clients.ApiResponse
> echo_oneof_mapped_pets_post(_api::DefaultApi, response_stream::Channel, one_of_mapped_pets::OneOfMappedPets; _mediaType=nothing) -> Channel{ OneOfMappedPets }, OpenAPI.Clients.ApiResponse
diff --git a/test/client/allany/AllAnyClient/docs/OneOfBaseType.md b/test/client/allany/AllAnyClient/docs/OneOfBaseType.md
new file mode 100644
index 0000000..2347884
--- /dev/null
+++ b/test/client/allany/AllAnyClient/docs/OneOfBaseType.md
@@ -0,0 +1,15 @@
+# OneOfBaseType
+
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | This is a oneOf model. The value must be exactly one of the following types: Float64, String | | [optional]
+
+
+
+
+[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/test/client/allany/AllAnyClient/docs/TypeWithAllArrayTypes.md b/test/client/allany/AllAnyClient/docs/TypeWithAllArrayTypes.md
new file mode 100644
index 0000000..e3f3acf
--- /dev/null
+++ b/test/client/allany/AllAnyClient/docs/TypeWithAllArrayTypes.md
@@ -0,0 +1,15 @@
+# TypeWithAllArrayTypes
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**oneofbase** | [**Vector{OneOfBaseType}**](OneOfBaseType.md) | | [optional] [default to nothing]
+**anyofbase** | [**Vector{AnyOfBaseType}**](AnyOfBaseType.md) | | [optional] [default to nothing]
+**oneofpets** | [**Vector{OneOfPets}**](OneOfPets.md) | | [optional] [default to nothing]
+**anyofpets** | [**Vector{AnyOfPets}**](AnyOfPets.md) | | [optional] [default to nothing]
+
+
+[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/test/client/allany/AllAnyClient/src/apis/api_DefaultApi.jl b/test/client/allany/AllAnyClient/src/apis/api_DefaultApi.jl
index 14291ac..72139a5 100644
--- a/test/client/allany/AllAnyClient/src/apis/api_DefaultApi.jl
+++ b/test/client/allany/AllAnyClient/src/apis/api_DefaultApi.jl
@@ -11,6 +11,32 @@ This can be used to construct the `OpenAPI.Clients.Client` instance.
"""
basepath(::Type{ DefaultApi }) = "http://localhost"
+const _returntypes_echo_anyof_base_type_post_DefaultApi = Dict{Regex,Type}(
+ Regex("^" * replace("200", "x"=>".") * "\$") => AnyOfBaseType,
+)
+
+function _oacinternal_echo_anyof_base_type_post(_api::DefaultApi, any_of_base_type::AnyOfBaseType; _mediaType=nothing)
+ _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_echo_anyof_base_type_post_DefaultApi, "/echo_anyof_base_type", [], any_of_base_type)
+ OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ])
+ OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType])
+ return _ctx
+end
+
+@doc raw"""Params:
+- any_of_base_type::AnyOfBaseType (required)
+
+Return: AnyOfBaseType, OpenAPI.Clients.ApiResponse
+"""
+function echo_anyof_base_type_post(_api::DefaultApi, any_of_base_type::AnyOfBaseType; _mediaType=nothing)
+ _ctx = _oacinternal_echo_anyof_base_type_post(_api, any_of_base_type; _mediaType=_mediaType)
+ return OpenAPI.Clients.exec(_ctx)
+end
+
+function echo_anyof_base_type_post(_api::DefaultApi, response_stream::Channel, any_of_base_type::AnyOfBaseType; _mediaType=nothing)
+ _ctx = _oacinternal_echo_anyof_base_type_post(_api, any_of_base_type; _mediaType=_mediaType)
+ return OpenAPI.Clients.exec(_ctx, response_stream)
+end
+
const _returntypes_echo_anyof_mapped_pets_post_DefaultApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => AnyOfMappedPets,
)
@@ -63,6 +89,58 @@ function echo_anyof_pets_post(_api::DefaultApi, response_stream::Channel, any_of
return OpenAPI.Clients.exec(_ctx, response_stream)
end
+const _returntypes_echo_arrays_post_DefaultApi = Dict{Regex,Type}(
+ Regex("^" * replace("200", "x"=>".") * "\$") => TypeWithAllArrayTypes,
+)
+
+function _oacinternal_echo_arrays_post(_api::DefaultApi, type_with_all_array_types::TypeWithAllArrayTypes; _mediaType=nothing)
+ _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_echo_arrays_post_DefaultApi, "/echo_arrays", [], type_with_all_array_types)
+ OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ])
+ OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType])
+ return _ctx
+end
+
+@doc raw"""Params:
+- type_with_all_array_types::TypeWithAllArrayTypes (required)
+
+Return: TypeWithAllArrayTypes, OpenAPI.Clients.ApiResponse
+"""
+function echo_arrays_post(_api::DefaultApi, type_with_all_array_types::TypeWithAllArrayTypes; _mediaType=nothing)
+ _ctx = _oacinternal_echo_arrays_post(_api, type_with_all_array_types; _mediaType=_mediaType)
+ return OpenAPI.Clients.exec(_ctx)
+end
+
+function echo_arrays_post(_api::DefaultApi, response_stream::Channel, type_with_all_array_types::TypeWithAllArrayTypes; _mediaType=nothing)
+ _ctx = _oacinternal_echo_arrays_post(_api, type_with_all_array_types; _mediaType=_mediaType)
+ return OpenAPI.Clients.exec(_ctx, response_stream)
+end
+
+const _returntypes_echo_oneof_base_type_post_DefaultApi = Dict{Regex,Type}(
+ Regex("^" * replace("200", "x"=>".") * "\$") => OneOfBaseType,
+)
+
+function _oacinternal_echo_oneof_base_type_post(_api::DefaultApi, one_of_base_type::OneOfBaseType; _mediaType=nothing)
+ _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_echo_oneof_base_type_post_DefaultApi, "/echo_oneof_base_type", [], one_of_base_type)
+ OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ])
+ OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType])
+ return _ctx
+end
+
+@doc raw"""Params:
+- one_of_base_type::OneOfBaseType (required)
+
+Return: OneOfBaseType, OpenAPI.Clients.ApiResponse
+"""
+function echo_oneof_base_type_post(_api::DefaultApi, one_of_base_type::OneOfBaseType; _mediaType=nothing)
+ _ctx = _oacinternal_echo_oneof_base_type_post(_api, one_of_base_type; _mediaType=_mediaType)
+ return OpenAPI.Clients.exec(_ctx)
+end
+
+function echo_oneof_base_type_post(_api::DefaultApi, response_stream::Channel, one_of_base_type::OneOfBaseType; _mediaType=nothing)
+ _ctx = _oacinternal_echo_oneof_base_type_post(_api, one_of_base_type; _mediaType=_mediaType)
+ return OpenAPI.Clients.exec(_ctx, response_stream)
+end
+
const _returntypes_echo_oneof_mapped_pets_post_DefaultApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => OneOfMappedPets,
)
@@ -115,7 +193,10 @@ function echo_oneof_pets_post(_api::DefaultApi, response_stream::Channel, one_of
return OpenAPI.Clients.exec(_ctx, response_stream)
end
+export echo_anyof_base_type_post
export echo_anyof_mapped_pets_post
export echo_anyof_pets_post
+export echo_arrays_post
+export echo_oneof_base_type_post
export echo_oneof_mapped_pets_post
export echo_oneof_pets_post
diff --git a/test/client/allany/AllAnyClient/src/modelincludes.jl b/test/client/allany/AllAnyClient/src/modelincludes.jl
index a119ea4..fe46dd5 100644
--- a/test/client/allany/AllAnyClient/src/modelincludes.jl
+++ b/test/client/allany/AllAnyClient/src/modelincludes.jl
@@ -1,10 +1,13 @@
# This file was generated by the Julia OpenAPI Code Generator
# Do not modify this file directly. Modify the OpenAPI specification instead.
+include("models/model_AnyOfBaseType.jl")
include("models/model_AnyOfMappedPets.jl")
include("models/model_AnyOfPets.jl")
include("models/model_Cat.jl")
include("models/model_Dog.jl")
+include("models/model_OneOfBaseType.jl")
include("models/model_OneOfMappedPets.jl")
include("models/model_OneOfPets.jl")
include("models/model_Pet.jl")
+include("models/model_TypeWithAllArrayTypes.jl")
diff --git a/test/client/allany/AllAnyClient/src/models/model_AnyOfBaseType.jl b/test/client/allany/AllAnyClient/src/models/model_AnyOfBaseType.jl
new file mode 100644
index 0000000..57a265c
--- /dev/null
+++ b/test/client/allany/AllAnyClient/src/models/model_AnyOfBaseType.jl
@@ -0,0 +1,20 @@
+# This file was generated by the Julia OpenAPI Code Generator
+# Do not modify this file directly. Modify the OpenAPI specification instead.
+
+
+
+@doc raw"""AnyOfBaseType
+
+ AnyOfBaseType(; value=nothing)
+"""
+mutable struct AnyOfBaseType <: OpenAPI.AnyOfAPIModel
+ value::Any # Union{ Float64, String }
+ AnyOfBaseType() = new()
+ AnyOfBaseType(value) = new(value)
+end # type AnyOfBaseType
+
+function OpenAPI.property_type(::Type{ AnyOfBaseType }, name::Symbol, json::Dict{String,Any})
+
+ # no discriminator specified, can't determine the exact type
+ return fieldtype(AnyOfBaseType, name)
+end
diff --git a/test/client/allany/AllAnyClient/src/models/model_OneOfBaseType.jl b/test/client/allany/AllAnyClient/src/models/model_OneOfBaseType.jl
new file mode 100644
index 0000000..073188f
--- /dev/null
+++ b/test/client/allany/AllAnyClient/src/models/model_OneOfBaseType.jl
@@ -0,0 +1,20 @@
+# This file was generated by the Julia OpenAPI Code Generator
+# Do not modify this file directly. Modify the OpenAPI specification instead.
+
+
+
+@doc raw"""OneOfBaseType
+
+ OneOfBaseType(; value=nothing)
+"""
+mutable struct OneOfBaseType <: OpenAPI.OneOfAPIModel
+ value::Any # Union{ Float64, String }
+ OneOfBaseType() = new()
+ OneOfBaseType(value) = new(value)
+end # type OneOfBaseType
+
+function OpenAPI.property_type(::Type{ OneOfBaseType }, name::Symbol, json::Dict{String,Any})
+
+ # no discriminator specified, can't determine the exact type
+ return fieldtype(OneOfBaseType, name)
+end
diff --git a/test/client/allany/AllAnyClient/src/models/model_TypeWithAllArrayTypes.jl b/test/client/allany/AllAnyClient/src/models/model_TypeWithAllArrayTypes.jl
new file mode 100644
index 0000000..e781139
--- /dev/null
+++ b/test/client/allany/AllAnyClient/src/models/model_TypeWithAllArrayTypes.jl
@@ -0,0 +1,42 @@
+# This file was generated by the Julia OpenAPI Code Generator
+# Do not modify this file directly. Modify the OpenAPI specification instead.
+
+
+@doc raw"""TypeWithAllArrayTypes
+
+ TypeWithAllArrayTypes(;
+ oneofbase=nothing,
+ anyofbase=nothing,
+ oneofpets=nothing,
+ anyofpets=nothing,
+ )
+
+ - oneofbase::Vector{OneOfBaseType}
+ - anyofbase::Vector{AnyOfBaseType}
+ - oneofpets::Vector{OneOfPets}
+ - anyofpets::Vector{AnyOfPets}
+"""
+Base.@kwdef mutable struct TypeWithAllArrayTypes <: OpenAPI.APIModel
+ oneofbase::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{OneOfBaseType} }
+ anyofbase::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{AnyOfBaseType} }
+ oneofpets::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{OneOfPets} }
+ anyofpets::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{AnyOfPets} }
+
+ function TypeWithAllArrayTypes(oneofbase, anyofbase, oneofpets, anyofpets, )
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("oneofbase"), oneofbase)
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("anyofbase"), anyofbase)
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("oneofpets"), oneofpets)
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("anyofpets"), anyofpets)
+ return new(oneofbase, anyofbase, oneofpets, anyofpets, )
+ end
+end # type TypeWithAllArrayTypes
+
+const _property_types_TypeWithAllArrayTypes = Dict{Symbol,String}(Symbol("oneofbase")=>"Vector{OneOfBaseType}", Symbol("anyofbase")=>"Vector{AnyOfBaseType}", Symbol("oneofpets")=>"Vector{OneOfPets}", Symbol("anyofpets")=>"Vector{AnyOfPets}", )
+OpenAPI.property_type(::Type{ TypeWithAllArrayTypes }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_TypeWithAllArrayTypes[name]))}
+
+function check_required(o::TypeWithAllArrayTypes)
+ true
+end
+
+function OpenAPI.validate_property(::Type{ TypeWithAllArrayTypes }, name::Symbol, val)
+end
diff --git a/test/client/allany/runtests.jl b/test/client/allany/runtests.jl
index 7090d1b..29aa289 100644
--- a/test/client/allany/runtests.jl
+++ b/test/client/allany/runtests.jl
@@ -27,6 +27,7 @@ function pet_equals(dog1::M.Dog, dog2::M.Dog)
dog1.pet_type == dog2.pet_type && dog1.bark == dog2.bark && dog1.breed == dog2.breed
end
pet_equals(pet1::OpenAPI.UnionAPIModel, pet2::OpenAPI.UnionAPIModel) = pet_equals(pet1.value, pet2.value)
+basetype_equals(val1::OpenAPI.UnionAPIModel, val2::OpenAPI.UnionAPIModel) = val1.value == val2.value
function runtests()
@testset "allany" begin
@@ -49,6 +50,29 @@ function runtests()
pet = M.OneOfPets(cat)
api_return, http_resp = echo_oneof_pets_post(api, pet)
@test pet_equals(api_return, pet)
+
+ val = M.AnyOfBaseType("hello")
+ api_return, http_resp = echo_anyof_base_type_post(api, val)
+ @test basetype_equals(api_return, val)
+
+ val = M.OneOfBaseType(100.1)
+ api_return, http_resp = echo_oneof_base_type_post(api, val)
+ @test basetype_equals(api_return, val)
+
+ arr = M.TypeWithAllArrayTypes()
+ arr.oneofbase = [M.OneOfBaseType(1), M.OneOfBaseType(2)]
+ arr.anyofbase = [M.AnyOfBaseType("hello"), M.AnyOfBaseType("world")]
+ arr.oneofpets = [M.OneOfPets(cat), M.OneOfPets(dog)]
+ arr.anyofpets = [M.AnyOfPets(cat), M.AnyOfPets(dog)]
+
+ api_return, http_resp = echo_arrays_post(api, arr)
+
+ for idx in 1:2
+ @test basetype_equals(arr.oneofbase[idx], api_return.oneofbase[idx])
+ @test basetype_equals(arr.anyofbase[idx], api_return.anyofbase[idx])
+ @test pet_equals(arr.oneofpets[idx], api_return.oneofpets[idx])
+ @test pet_equals(arr.anyofpets[idx], api_return.anyofpets[idx])
+ end
end
end
diff --git a/test/server/allany/AllAnyServer/.openapi-generator/FILES b/test/server/allany/AllAnyServer/.openapi-generator/FILES
index 6689b7c..053d86e 100644
--- a/test/server/allany/AllAnyServer/.openapi-generator/FILES
+++ b/test/server/allany/AllAnyServer/.openapi-generator/FILES
@@ -1,19 +1,25 @@
README.md
+docs/AnyOfBaseType.md
docs/AnyOfMappedPets.md
docs/AnyOfPets.md
docs/Cat.md
docs/DefaultApi.md
docs/Dog.md
+docs/OneOfBaseType.md
docs/OneOfMappedPets.md
docs/OneOfPets.md
docs/Pet.md
+docs/TypeWithAllArrayTypes.md
src/AllAnyServer.jl
src/apis/api_DefaultApi.jl
src/modelincludes.jl
+src/models/model_AnyOfBaseType.jl
src/models/model_AnyOfMappedPets.jl
src/models/model_AnyOfPets.jl
src/models/model_Cat.jl
src/models/model_Dog.jl
+src/models/model_OneOfBaseType.jl
src/models/model_OneOfMappedPets.jl
src/models/model_OneOfPets.jl
src/models/model_Pet.jl
+src/models/model_TypeWithAllArrayTypes.jl
diff --git a/test/server/allany/AllAnyServer/.openapi-generator/VERSION b/test/server/allany/AllAnyServer/.openapi-generator/VERSION
index 757e674..44bad91 100644
--- a/test/server/allany/AllAnyServer/.openapi-generator/VERSION
+++ b/test/server/allany/AllAnyServer/.openapi-generator/VERSION
@@ -1 +1 @@
-7.0.0-SNAPSHOT
\ No newline at end of file
+7.0.1-SNAPSHOT
\ No newline at end of file
diff --git a/test/server/allany/AllAnyServer/README.md b/test/server/allany/AllAnyServer/README.md
index 44c563a..b7456c3 100644
--- a/test/server/allany/AllAnyServer/README.md
+++ b/test/server/allany/AllAnyServer/README.md
@@ -41,8 +41,11 @@ The following server methods must be implemented:
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
+*DefaultApi* | [**echo_anyof_base_type_post**](docs/DefaultApi.md#echo_anyof_base_type_post) | **POST** /echo_anyof_base_type |
*DefaultApi* | [**echo_anyof_mapped_pets_post**](docs/DefaultApi.md#echo_anyof_mapped_pets_post) | **POST** /echo_anyof_mapped_pets |
*DefaultApi* | [**echo_anyof_pets_post**](docs/DefaultApi.md#echo_anyof_pets_post) | **POST** /echo_anyof_pets |
+*DefaultApi* | [**echo_arrays_post**](docs/DefaultApi.md#echo_arrays_post) | **POST** /echo_arrays |
+*DefaultApi* | [**echo_oneof_base_type_post**](docs/DefaultApi.md#echo_oneof_base_type_post) | **POST** /echo_oneof_base_type |
*DefaultApi* | [**echo_oneof_mapped_pets_post**](docs/DefaultApi.md#echo_oneof_mapped_pets_post) | **POST** /echo_oneof_mapped_pets |
*DefaultApi* | [**echo_oneof_pets_post**](docs/DefaultApi.md#echo_oneof_pets_post) | **POST** /echo_oneof_pets |
@@ -50,13 +53,16 @@ Class | Method | HTTP request | Description
## Models
+ - [AnyOfBaseType](docs/AnyOfBaseType.md)
- [AnyOfMappedPets](docs/AnyOfMappedPets.md)
- [AnyOfPets](docs/AnyOfPets.md)
- [Cat](docs/Cat.md)
- [Dog](docs/Dog.md)
+ - [OneOfBaseType](docs/OneOfBaseType.md)
- [OneOfMappedPets](docs/OneOfMappedPets.md)
- [OneOfPets](docs/OneOfPets.md)
- [Pet](docs/Pet.md)
+ - [TypeWithAllArrayTypes](docs/TypeWithAllArrayTypes.md)
diff --git a/test/server/allany/AllAnyServer/docs/AnyOfBaseType.md b/test/server/allany/AllAnyServer/docs/AnyOfBaseType.md
new file mode 100644
index 0000000..f4e20a9
--- /dev/null
+++ b/test/server/allany/AllAnyServer/docs/AnyOfBaseType.md
@@ -0,0 +1,16 @@
+# AnyOfBaseType
+
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | This is a anyOf model. The value must be any of the following types: Float64, String | | [optional]
+
+
+
+
+
+[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/test/server/allany/AllAnyServer/docs/DefaultApi.md b/test/server/allany/AllAnyServer/docs/DefaultApi.md
index 94f7520..1b7bb3c 100644
--- a/test/server/allany/AllAnyServer/docs/DefaultApi.md
+++ b/test/server/allany/AllAnyServer/docs/DefaultApi.md
@@ -4,12 +4,42 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
+[**echo_anyof_base_type_post**](DefaultApi.md#echo_anyof_base_type_post) | **POST** /echo_anyof_base_type |
[**echo_anyof_mapped_pets_post**](DefaultApi.md#echo_anyof_mapped_pets_post) | **POST** /echo_anyof_mapped_pets |
[**echo_anyof_pets_post**](DefaultApi.md#echo_anyof_pets_post) | **POST** /echo_anyof_pets |
+[**echo_arrays_post**](DefaultApi.md#echo_arrays_post) | **POST** /echo_arrays |
+[**echo_oneof_base_type_post**](DefaultApi.md#echo_oneof_base_type_post) | **POST** /echo_oneof_base_type |
[**echo_oneof_mapped_pets_post**](DefaultApi.md#echo_oneof_mapped_pets_post) | **POST** /echo_oneof_mapped_pets |
[**echo_oneof_pets_post**](DefaultApi.md#echo_oneof_pets_post) | **POST** /echo_oneof_pets |
+# **echo_anyof_base_type_post**
+> echo_anyof_base_type_post(req::HTTP.Request, any_of_base_type::AnyOfBaseType;) -> AnyOfBaseType
+
+
+
+### Required Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **req** | **HTTP.Request** | The HTTP Request object |
+**any_of_base_type** | [**AnyOfBaseType**](AnyOfBaseType.md)| |
+
+### Return type
+
+[**AnyOfBaseType**](AnyOfBaseType.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
# **echo_anyof_mapped_pets_post**
> echo_anyof_mapped_pets_post(req::HTTP.Request, any_of_mapped_pets::AnyOfMappedPets;) -> AnyOfMappedPets
@@ -64,6 +94,60 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+# **echo_arrays_post**
+> echo_arrays_post(req::HTTP.Request, type_with_all_array_types::TypeWithAllArrayTypes;) -> TypeWithAllArrayTypes
+
+
+
+### Required Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **req** | **HTTP.Request** | The HTTP Request object |
+**type_with_all_array_types** | [**TypeWithAllArrayTypes**](TypeWithAllArrayTypes.md)| |
+
+### Return type
+
+[**TypeWithAllArrayTypes**](TypeWithAllArrayTypes.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **echo_oneof_base_type_post**
+> echo_oneof_base_type_post(req::HTTP.Request, one_of_base_type::OneOfBaseType;) -> OneOfBaseType
+
+
+
+### Required Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **req** | **HTTP.Request** | The HTTP Request object |
+**one_of_base_type** | [**OneOfBaseType**](OneOfBaseType.md)| |
+
+### Return type
+
+[**OneOfBaseType**](OneOfBaseType.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
# **echo_oneof_mapped_pets_post**
> echo_oneof_mapped_pets_post(req::HTTP.Request, one_of_mapped_pets::OneOfMappedPets;) -> OneOfMappedPets
diff --git a/test/server/allany/AllAnyServer/docs/OneOfBaseType.md b/test/server/allany/AllAnyServer/docs/OneOfBaseType.md
new file mode 100644
index 0000000..2347884
--- /dev/null
+++ b/test/server/allany/AllAnyServer/docs/OneOfBaseType.md
@@ -0,0 +1,15 @@
+# OneOfBaseType
+
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | This is a oneOf model. The value must be exactly one of the following types: Float64, String | | [optional]
+
+
+
+
+[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/test/server/allany/AllAnyServer/docs/TypeWithAllArrayTypes.md b/test/server/allany/AllAnyServer/docs/TypeWithAllArrayTypes.md
new file mode 100644
index 0000000..e3f3acf
--- /dev/null
+++ b/test/server/allany/AllAnyServer/docs/TypeWithAllArrayTypes.md
@@ -0,0 +1,15 @@
+# TypeWithAllArrayTypes
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**oneofbase** | [**Vector{OneOfBaseType}**](OneOfBaseType.md) | | [optional] [default to nothing]
+**anyofbase** | [**Vector{AnyOfBaseType}**](AnyOfBaseType.md) | | [optional] [default to nothing]
+**oneofpets** | [**Vector{OneOfPets}**](OneOfPets.md) | | [optional] [default to nothing]
+**anyofpets** | [**Vector{AnyOfPets}**](AnyOfPets.md) | | [optional] [default to nothing]
+
+
+[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/test/server/allany/AllAnyServer/src/AllAnyServer.jl b/test/server/allany/AllAnyServer/src/AllAnyServer.jl
index 66cb275..d6f6c9a 100644
--- a/test/server/allany/AllAnyServer/src/AllAnyServer.jl
+++ b/test/server/allany/AllAnyServer/src/AllAnyServer.jl
@@ -7,12 +7,21 @@ Encapsulates generated server code for AllAnyServer
The following server methods must be implemented:
+- **echo_anyof_base_type_post**
+ - *invocation:* POST /echo_anyof_base_type
+ - *signature:* echo_anyof_base_type_post(req::HTTP.Request, any_of_base_type::AnyOfBaseType;) -> AnyOfBaseType
- **echo_anyof_mapped_pets_post**
- *invocation:* POST /echo_anyof_mapped_pets
- *signature:* echo_anyof_mapped_pets_post(req::HTTP.Request, any_of_mapped_pets::AnyOfMappedPets;) -> AnyOfMappedPets
- **echo_anyof_pets_post**
- *invocation:* POST /echo_anyof_pets
- *signature:* echo_anyof_pets_post(req::HTTP.Request, any_of_pets::AnyOfPets;) -> AnyOfPets
+- **echo_arrays_post**
+ - *invocation:* POST /echo_arrays
+ - *signature:* echo_arrays_post(req::HTTP.Request, type_with_all_array_types::TypeWithAllArrayTypes;) -> TypeWithAllArrayTypes
+- **echo_oneof_base_type_post**
+ - *invocation:* POST /echo_oneof_base_type
+ - *signature:* echo_oneof_base_type_post(req::HTTP.Request, one_of_base_type::OneOfBaseType;) -> OneOfBaseType
- **echo_oneof_mapped_pets_post**
- *invocation:* POST /echo_oneof_mapped_pets
- *signature:* echo_oneof_mapped_pets_post(req::HTTP.Request, one_of_mapped_pets::OneOfMappedPets;) -> OneOfMappedPets
diff --git a/test/server/allany/AllAnyServer/src/apis/api_DefaultApi.jl b/test/server/allany/AllAnyServer/src/apis/api_DefaultApi.jl
index e22bd70..2831204 100644
--- a/test/server/allany/AllAnyServer/src/apis/api_DefaultApi.jl
+++ b/test/server/allany/AllAnyServer/src/apis/api_DefaultApi.jl
@@ -2,6 +2,33 @@
# Do not modify this file directly. Modify the OpenAPI specification instead.
+function echo_anyof_base_type_post_read(handler)
+ function echo_anyof_base_type_post_read_handler(req::HTTP.Request)
+ openapi_params = Dict{String,Any}()
+ openapi_params["AnyOfBaseType"] = OpenAPI.Servers.to_param_type(AnyOfBaseType, String(req.body))
+ req.context[:openapi_params] = openapi_params
+
+ return handler(req)
+ end
+end
+
+function echo_anyof_base_type_post_validate(handler)
+ function echo_anyof_base_type_post_validate_handler(req::HTTP.Request)
+ openapi_params = req.context[:openapi_params]
+
+ return handler(req)
+ end
+end
+
+function echo_anyof_base_type_post_invoke(impl; post_invoke=nothing)
+ function echo_anyof_base_type_post_invoke_handler(req::HTTP.Request)
+ openapi_params = req.context[:openapi_params]
+ ret = impl.echo_anyof_base_type_post(req::HTTP.Request, openapi_params["AnyOfBaseType"];)
+ resp = OpenAPI.Servers.server_response(ret)
+ return (post_invoke === nothing) ? resp : post_invoke(req, resp)
+ end
+end
+
function echo_anyof_mapped_pets_post_read(handler)
function echo_anyof_mapped_pets_post_read_handler(req::HTTP.Request)
openapi_params = Dict{String,Any}()
@@ -56,6 +83,60 @@ function echo_anyof_pets_post_invoke(impl; post_invoke=nothing)
end
end
+function echo_arrays_post_read(handler)
+ function echo_arrays_post_read_handler(req::HTTP.Request)
+ openapi_params = Dict{String,Any}()
+ openapi_params["TypeWithAllArrayTypes"] = OpenAPI.Servers.to_param_type(TypeWithAllArrayTypes, String(req.body))
+ req.context[:openapi_params] = openapi_params
+
+ return handler(req)
+ end
+end
+
+function echo_arrays_post_validate(handler)
+ function echo_arrays_post_validate_handler(req::HTTP.Request)
+ openapi_params = req.context[:openapi_params]
+
+ return handler(req)
+ end
+end
+
+function echo_arrays_post_invoke(impl; post_invoke=nothing)
+ function echo_arrays_post_invoke_handler(req::HTTP.Request)
+ openapi_params = req.context[:openapi_params]
+ ret = impl.echo_arrays_post(req::HTTP.Request, openapi_params["TypeWithAllArrayTypes"];)
+ resp = OpenAPI.Servers.server_response(ret)
+ return (post_invoke === nothing) ? resp : post_invoke(req, resp)
+ end
+end
+
+function echo_oneof_base_type_post_read(handler)
+ function echo_oneof_base_type_post_read_handler(req::HTTP.Request)
+ openapi_params = Dict{String,Any}()
+ openapi_params["OneOfBaseType"] = OpenAPI.Servers.to_param_type(OneOfBaseType, String(req.body))
+ req.context[:openapi_params] = openapi_params
+
+ return handler(req)
+ end
+end
+
+function echo_oneof_base_type_post_validate(handler)
+ function echo_oneof_base_type_post_validate_handler(req::HTTP.Request)
+ openapi_params = req.context[:openapi_params]
+
+ return handler(req)
+ end
+end
+
+function echo_oneof_base_type_post_invoke(impl; post_invoke=nothing)
+ function echo_oneof_base_type_post_invoke_handler(req::HTTP.Request)
+ openapi_params = req.context[:openapi_params]
+ ret = impl.echo_oneof_base_type_post(req::HTTP.Request, openapi_params["OneOfBaseType"];)
+ resp = OpenAPI.Servers.server_response(ret)
+ return (post_invoke === nothing) ? resp : post_invoke(req, resp)
+ end
+end
+
function echo_oneof_mapped_pets_post_read(handler)
function echo_oneof_mapped_pets_post_read_handler(req::HTTP.Request)
openapi_params = Dict{String,Any}()
@@ -112,8 +193,11 @@ end
function registerDefaultApi(router::HTTP.Router, impl; path_prefix::String="", optional_middlewares...)
+ HTTP.register!(router, "POST", path_prefix * "/echo_anyof_base_type", OpenAPI.Servers.middleware(impl, echo_anyof_base_type_post_read, echo_anyof_base_type_post_validate, echo_anyof_base_type_post_invoke; optional_middlewares...))
HTTP.register!(router, "POST", path_prefix * "/echo_anyof_mapped_pets", OpenAPI.Servers.middleware(impl, echo_anyof_mapped_pets_post_read, echo_anyof_mapped_pets_post_validate, echo_anyof_mapped_pets_post_invoke; optional_middlewares...))
HTTP.register!(router, "POST", path_prefix * "/echo_anyof_pets", OpenAPI.Servers.middleware(impl, echo_anyof_pets_post_read, echo_anyof_pets_post_validate, echo_anyof_pets_post_invoke; optional_middlewares...))
+ HTTP.register!(router, "POST", path_prefix * "/echo_arrays", OpenAPI.Servers.middleware(impl, echo_arrays_post_read, echo_arrays_post_validate, echo_arrays_post_invoke; optional_middlewares...))
+ HTTP.register!(router, "POST", path_prefix * "/echo_oneof_base_type", OpenAPI.Servers.middleware(impl, echo_oneof_base_type_post_read, echo_oneof_base_type_post_validate, echo_oneof_base_type_post_invoke; optional_middlewares...))
HTTP.register!(router, "POST", path_prefix * "/echo_oneof_mapped_pets", OpenAPI.Servers.middleware(impl, echo_oneof_mapped_pets_post_read, echo_oneof_mapped_pets_post_validate, echo_oneof_mapped_pets_post_invoke; optional_middlewares...))
HTTP.register!(router, "POST", path_prefix * "/echo_oneof_pets", OpenAPI.Servers.middleware(impl, echo_oneof_pets_post_read, echo_oneof_pets_post_validate, echo_oneof_pets_post_invoke; optional_middlewares...))
return router
diff --git a/test/server/allany/AllAnyServer/src/modelincludes.jl b/test/server/allany/AllAnyServer/src/modelincludes.jl
index a119ea4..fe46dd5 100644
--- a/test/server/allany/AllAnyServer/src/modelincludes.jl
+++ b/test/server/allany/AllAnyServer/src/modelincludes.jl
@@ -1,10 +1,13 @@
# This file was generated by the Julia OpenAPI Code Generator
# Do not modify this file directly. Modify the OpenAPI specification instead.
+include("models/model_AnyOfBaseType.jl")
include("models/model_AnyOfMappedPets.jl")
include("models/model_AnyOfPets.jl")
include("models/model_Cat.jl")
include("models/model_Dog.jl")
+include("models/model_OneOfBaseType.jl")
include("models/model_OneOfMappedPets.jl")
include("models/model_OneOfPets.jl")
include("models/model_Pet.jl")
+include("models/model_TypeWithAllArrayTypes.jl")
diff --git a/test/server/allany/AllAnyServer/src/models/model_AnyOfBaseType.jl b/test/server/allany/AllAnyServer/src/models/model_AnyOfBaseType.jl
new file mode 100644
index 0000000..57a265c
--- /dev/null
+++ b/test/server/allany/AllAnyServer/src/models/model_AnyOfBaseType.jl
@@ -0,0 +1,20 @@
+# This file was generated by the Julia OpenAPI Code Generator
+# Do not modify this file directly. Modify the OpenAPI specification instead.
+
+
+
+@doc raw"""AnyOfBaseType
+
+ AnyOfBaseType(; value=nothing)
+"""
+mutable struct AnyOfBaseType <: OpenAPI.AnyOfAPIModel
+ value::Any # Union{ Float64, String }
+ AnyOfBaseType() = new()
+ AnyOfBaseType(value) = new(value)
+end # type AnyOfBaseType
+
+function OpenAPI.property_type(::Type{ AnyOfBaseType }, name::Symbol, json::Dict{String,Any})
+
+ # no discriminator specified, can't determine the exact type
+ return fieldtype(AnyOfBaseType, name)
+end
diff --git a/test/server/allany/AllAnyServer/src/models/model_OneOfBaseType.jl b/test/server/allany/AllAnyServer/src/models/model_OneOfBaseType.jl
new file mode 100644
index 0000000..073188f
--- /dev/null
+++ b/test/server/allany/AllAnyServer/src/models/model_OneOfBaseType.jl
@@ -0,0 +1,20 @@
+# This file was generated by the Julia OpenAPI Code Generator
+# Do not modify this file directly. Modify the OpenAPI specification instead.
+
+
+
+@doc raw"""OneOfBaseType
+
+ OneOfBaseType(; value=nothing)
+"""
+mutable struct OneOfBaseType <: OpenAPI.OneOfAPIModel
+ value::Any # Union{ Float64, String }
+ OneOfBaseType() = new()
+ OneOfBaseType(value) = new(value)
+end # type OneOfBaseType
+
+function OpenAPI.property_type(::Type{ OneOfBaseType }, name::Symbol, json::Dict{String,Any})
+
+ # no discriminator specified, can't determine the exact type
+ return fieldtype(OneOfBaseType, name)
+end
diff --git a/test/server/allany/AllAnyServer/src/models/model_TypeWithAllArrayTypes.jl b/test/server/allany/AllAnyServer/src/models/model_TypeWithAllArrayTypes.jl
new file mode 100644
index 0000000..e781139
--- /dev/null
+++ b/test/server/allany/AllAnyServer/src/models/model_TypeWithAllArrayTypes.jl
@@ -0,0 +1,42 @@
+# This file was generated by the Julia OpenAPI Code Generator
+# Do not modify this file directly. Modify the OpenAPI specification instead.
+
+
+@doc raw"""TypeWithAllArrayTypes
+
+ TypeWithAllArrayTypes(;
+ oneofbase=nothing,
+ anyofbase=nothing,
+ oneofpets=nothing,
+ anyofpets=nothing,
+ )
+
+ - oneofbase::Vector{OneOfBaseType}
+ - anyofbase::Vector{AnyOfBaseType}
+ - oneofpets::Vector{OneOfPets}
+ - anyofpets::Vector{AnyOfPets}
+"""
+Base.@kwdef mutable struct TypeWithAllArrayTypes <: OpenAPI.APIModel
+ oneofbase::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{OneOfBaseType} }
+ anyofbase::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{AnyOfBaseType} }
+ oneofpets::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{OneOfPets} }
+ anyofpets::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{AnyOfPets} }
+
+ function TypeWithAllArrayTypes(oneofbase, anyofbase, oneofpets, anyofpets, )
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("oneofbase"), oneofbase)
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("anyofbase"), anyofbase)
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("oneofpets"), oneofpets)
+ OpenAPI.validate_property(TypeWithAllArrayTypes, Symbol("anyofpets"), anyofpets)
+ return new(oneofbase, anyofbase, oneofpets, anyofpets, )
+ end
+end # type TypeWithAllArrayTypes
+
+const _property_types_TypeWithAllArrayTypes = Dict{Symbol,String}(Symbol("oneofbase")=>"Vector{OneOfBaseType}", Symbol("anyofbase")=>"Vector{AnyOfBaseType}", Symbol("oneofpets")=>"Vector{OneOfPets}", Symbol("anyofpets")=>"Vector{AnyOfPets}", )
+OpenAPI.property_type(::Type{ TypeWithAllArrayTypes }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_TypeWithAllArrayTypes[name]))}
+
+function check_required(o::TypeWithAllArrayTypes)
+ true
+end
+
+function OpenAPI.validate_property(::Type{ TypeWithAllArrayTypes }, name::Symbol, val)
+end
diff --git a/test/server/allany/allany_server.jl b/test/server/allany/allany_server.jl
index 61575da..09e4da4 100644
--- a/test/server/allany/allany_server.jl
+++ b/test/server/allany/allany_server.jl
@@ -8,6 +8,33 @@ using .AllAnyServer
const server = Ref{Any}(nothing)
+"""
+echo_arrays_post
+
+*invocation:* POST /echo_arrays
+"""
+function echo_arrays_post(req::HTTP.Request, type_with_all_array_types::AllAnyServer.TypeWithAllArrayTypes;) :: AllAnyServer.TypeWithAllArrayTypes
+ return type_with_all_array_types
+end
+
+"""
+echo_anyof_base_type_post
+
+*invocation:* POST /echo_anyof_base_type
+"""
+function echo_anyof_base_type_post(req::HTTP.Request, any_of_base_type::AllAnyServer.AnyOfBaseType;) :: AllAnyServer.AnyOfBaseType
+ return any_of_base_type
+end
+
+"""
+echo_oneof_base_type_post
+
+*invocation:* POST /echo_oneof_base_type
+"""
+function echo_oneof_base_type_post(req::HTTP.Request, one_of_base_type::AllAnyServer.OneOfBaseType;) :: AllAnyServer.OneOfBaseType
+ return one_of_base_type
+end
+
"""
echo_anyof_mapped_pets_post
diff --git a/test/specs/allany.yaml b/test/specs/allany.yaml
index e7d0ee9..8ef524c 100644
--- a/test/specs/allany.yaml
+++ b/test/specs/allany.yaml
@@ -67,6 +67,51 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/AnyOfPets'
+ /echo_oneof_base_type:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OneOfBaseType'
+ required: true
+ responses:
+ '200':
+ description: Successful response (echoes the request body)
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OneOfBaseType'
+ /echo_anyof_base_type:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnyOfBaseType'
+ required: true
+ responses:
+ '200':
+ description: Successful response (echoes the request body)
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnyOfBaseType'
+ /echo_arrays:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/TypeWithAllArrayTypes'
+ required: true
+ responses:
+ '200':
+ description: Successful response (echoes the request body)
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/TypeWithAllArrayTypes'
components:
schemas:
Pet:
@@ -129,3 +174,38 @@ components:
mapping:
dog: '#/components/schemas/Dog'
cat: '#/components/schemas/Cat'
+ OneOfBaseType:
+ oneOf:
+ - type: string
+ - type: number
+ AnyOfBaseType:
+ anyOf:
+ - type: string
+ - type: number
+ ArrayOfOneOfBaseType:
+ type: array
+ items:
+ $ref: '#/components/schemas/OneOfBaseType'
+ ArrayOfAnyOfBaseType:
+ type: array
+ items:
+ $ref: '#/components/schemas/AnyOfBaseType'
+ ArrayOfOneOfPets:
+ type: array
+ items:
+ $ref: '#/components/schemas/OneOfPets'
+ ArrayOfAnyOfPets:
+ type: array
+ items:
+ $ref: '#/components/schemas/AnyOfPets'
+ TypeWithAllArrayTypes:
+ type: object
+ properties:
+ oneofbase:
+ $ref: '#/components/schemas/ArrayOfOneOfBaseType'
+ anyofbase:
+ $ref: '#/components/schemas/ArrayOfAnyOfBaseType'
+ oneofpets:
+ $ref: '#/components/schemas/ArrayOfOneOfPets'
+ anyofpets:
+ $ref: '#/components/schemas/ArrayOfAnyOfPets'