Description
Description
When the Definition is an array of array or array of maps then the generated code is trying to use a method fromJson which is not present in the vector or map.
m_SystemStatus.clear();
if(multipart->hasContent(utility::conversions::to_string_t("SystemStatus")))
{
web::json::value jsonArray = web::json::value::parse
(ModelBase::stringFromHttpContent(multipart->getContent(
utility::conversions::to_string_t("SystemStatus"))));
for( auto& item : jsonArray.as_array() )
{
if(item.is_null())
{
m_SystemStatus.push_back( std::vector<utility::string_t>(nullptr) );
}
else
{
std::vector<utility::string_t> newItem
(std::vector<std::shared_ptr<utility::string_t>>());
newItem->fromJson(item);
m_SystemStatus.push_back( newItem );
}
}
The code is trying to invoke fromJson from an array which is obviously wrong.
Swagger-codegen version
2.3.0
3.0.0
Swagger declaration file content or url
Array of maps
IPAM:
type: "object"
properties:
Driver:
description: "Name of the IPAM driver to use."
type: "string"
default: "default"
Config:
description: "List of IPAM configuration options, specified as a map:
`{\"Subnet\": <CIDR>, \"IPRange\": <CIDR>, \"Gateway\": <IP address>, \"AuxAddress\":
<device_name:IP address>}`"
type: "array"
items:
type: "object"
additionalProperties:
type: "string"
Options:
description: "Driver-specific options, specified as a map."
type: "array"
items:
type: "object"
additionalProperties:
type: "string"
Array of arrays
DriverStatus:
description: |
Information specific to the storage driver, provided as
"label" / "value" pairs.
This information is provided by the storage driver, and formatted
in a way consistent with the output of `docker info` on the command
line.
<p><br /></p>
> **Note**: The information returned in this field, including the
> formatting of values and labels, should not be considered stable,
> and may change without notice.
type: "array"
items:
type: "array"
items:
type: "string"
example:
- ["Backing Filesystem", "extfs"]
- ["Supports d_type", "true"]
- ["Native Overlay Diff", "true"]
Command line used for generation
java -jar /home/dev/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i /home/dev/gen-test/yaml/docker-v132-subset.yaml -o /home/dev/gen-test/gen/ -l cpprest
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
I could fix this for example, but I don't know how to perform member items datatype or container type check. If someone could hint me I could try fixing this.
This problem does not exist with the qt5cpp for example as the static method tries to use the recursive method to serialize or deserialize.