Skip to content

Commit bbef124

Browse files
authored
Merge pull request #212 from printu/pk/fix-exposedports-warning
Allow ExposedPorts to be null in ContainerConfig
2 parents a9aef52 + 3bfb527 commit bbef124

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

docker-swagger.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
"type": "string"
487487
},
488488
"ExposedPorts": {
489-
"type": "object",
489+
"type": ["object","null"],
490490
"additionalProperties": {
491491
"type": "object",
492492
"enum": [{}],

generated/Model/ContainerConfig.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ContainerConfig
117117
*/
118118
protected $macAddress;
119119
/**
120-
* @var mixed[]
120+
* @var mixed[]|null
121121
*/
122122
protected $exposedPorts;
123123
/**
@@ -690,19 +690,19 @@ public function setMacAddress($macAddress = null)
690690
}
691691

692692
/**
693-
* @return mixed[]
693+
* @return mixed[]|null
694694
*/
695695
public function getExposedPorts()
696696
{
697697
return $this->exposedPorts;
698698
}
699699

700700
/**
701-
* @param mixed[] $exposedPorts
701+
* @param mixed[]|null $exposedPorts
702702
*
703703
* @return self
704704
*/
705-
public function setExposedPorts(\ArrayObject $exposedPorts = null)
705+
public function setExposedPorts($exposedPorts = null)
706706
{
707707
$this->exposedPorts = $exposedPorts;
708708

generated/Normalizer/ContainerConfigNormalizer.php

+20-8
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,18 @@ public function denormalize($data, $class, $format = null, array $context = [])
194194
$object->setMacAddress($data->{'MacAddress'});
195195
}
196196
if (property_exists($data, 'ExposedPorts')) {
197-
$values_7 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
198-
foreach ($data->{'ExposedPorts'} as $key_1 => $value_13) {
199-
$values_7[$key_1] = $value_13;
197+
$value_13 = $data->{'ExposedPorts'};
198+
if (is_object($data->{'ExposedPorts'})) {
199+
$values_7 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
200+
foreach ($data->{'ExposedPorts'} as $key_1 => $value_14) {
201+
$values_7[$key_1] = $value_14;
202+
}
203+
$value_13 = $values_7;
204+
}
205+
if (is_null($data->{'ExposedPorts'})) {
206+
$value_13 = $data->{'ExposedPorts'};
200207
}
201-
$object->setExposedPorts($values_7);
208+
$object->setExposedPorts($value_13);
202209
}
203210
if (property_exists($data, 'NetworkSettings')) {
204211
$object->setNetworkSettings($this->serializer->deserialize($data->{'NetworkSettings'}, 'Docker\\API\\Model\\NetworkConfig', 'raw', $context));
@@ -359,13 +366,18 @@ public function normalize($object, $format = null, array $context = [])
359366
if (null !== $object->getMacAddress()) {
360367
$data->{'MacAddress'} = $object->getMacAddress();
361368
}
362-
if (null !== $object->getExposedPorts()) {
369+
$value_13 = $object->getExposedPorts();
370+
if (is_object($object->getExposedPorts())) {
363371
$values_7 = new \stdClass();
364-
foreach ($object->getExposedPorts() as $key_1 => $value_13) {
365-
$values_7->{$key_1} = $value_13;
372+
foreach ($object->getExposedPorts() as $key_1 => $value_14) {
373+
$values_7->{$key_1} = $value_14;
366374
}
367-
$data->{'ExposedPorts'} = $values_7;
375+
$value_13 = $values_7;
376+
}
377+
if (is_null($object->getExposedPorts())) {
378+
$value_13 = $object->getExposedPorts();
368379
}
380+
$data->{'ExposedPorts'} = $value_13;
369381
if (null !== $object->getNetworkSettings()) {
370382
$data->{'NetworkSettings'} = $this->serializer->serialize($object->getNetworkSettings(), 'raw', $context);
371383
}

0 commit comments

Comments
 (0)