-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Labels
Description
Jane version(s) affected: 7.4.1
Description
When the OpenAPI v3 spec is as so:
"ExposedPorts": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {}
},
"description": "An object mapping ports to an empty object in the form:\n\n`{\"<port>/<tcp|udp|sctp>\": {}}`\n"
},
Empty additionalProperties are generated as an array rather than an object in the normalizer, whereas the denormalizer correctly creates an object.
How to reproduce
See above.
Possible Solution
additionalProperties normalizer and denormalizer should be the same.
Additional context
Here is the generated code:
if (null !== $object->getExposedPorts()) {
$values = [];
foreach ($object->getExposedPorts() as $key => $value) {
$values[$key] = $this->normalizer->normalize($value, 'json', $context);
}
$data['ExposedPorts'] = $values;
} if (\array_key_exists('ExposedPorts', $data) && null !== $data['ExposedPorts']) {
$values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
foreach ($data['ExposedPorts'] as $key => $value) {
$values[$key] = $this->denormalizer->denormalize($value, 'Docker\\API\\Model\\ContainerConfigExposedPortsItem', 'json', $context);
}
$object->setExposedPorts($values);