Skip to content

Commit b961da9

Browse files
committed
fix(spec): patch v1.54 nullables and date-time format
Hand-fix v1.54-patched.yaml so generated client survives real Docker API responses. Same class of fixes the v1.51 spec carries. - Convert nullable: true to OpenAPI 3.1 `type: [orig, 'null']` union. jane open-api-3-1 ignores nullable: true; only honors the type-array form. - Walk components.schemas and add 'null' to every non-required scalar/array property. Skip type:object with $ref additionalProperties (e.g. NetworkSettings.Networks) — making those nullable triggers a jane codegen bug where isOnlyNumericKeys short-circuits the denormalize loop. - Mark HostConfig and PortMap nullable at schema level. - Rename `format: date-time` to `format: dateTime`. jane parses date-time as `Y-m-d\TH:i:sP` which fails on Docker's nano-precision timestamps; the typo lets the field stay as a plain string (matches v1.51 hand-fix). `bin/docker-api docker:list -vv` now succeeds end-to-end against a live socket. composer test 7/7 green.
1 parent 98933f3 commit b961da9

604 files changed

Lines changed: 31754 additions & 21178 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generated/Client.php

Lines changed: 661 additions & 836 deletions
Large diffs are not rendered by default.

generated/Endpoint/BuildPrune.php

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,13 @@ class BuildPrune extends \WebProject\DockerApi\Library\Generated\Runtime\Client\
88
use \WebProject\DockerApi\Library\Generated\Runtime\Client\EndpointTrait;
99

1010
/**
11-
* @param array $queryParameters {
12-
*
13-
* @var int $keep-storage Amount of disk space in bytes to keep for cache
14-
*
15-
* > **Deprecated**: This parameter is deprecated and has been renamed to "reserved-space".
16-
* > It is kept for backward compatibility and will be removed in API v1.49.
17-
* @var int $reserved-space Amount of disk space in bytes to keep for cache
18-
* @var int $max-used-space Maximum amount of disk space allowed to keep for cache
19-
* @var int $min-free-space Target amount of free disk space after pruning
20-
* @var bool $all Remove all types of build cache
21-
* @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to
22-
* process on the list of build cache objects.
11+
* @param array{
12+
* "reserved-space"?: int, //Amount of disk space in bytes to keep for cache
13+
* "max-used-space"?: int, //Maximum amount of disk space allowed to keep for cache
14+
* "min-free-space"?: int, //Target amount of free disk space after pruning
15+
* "all"?: bool, //Remove all types of build cache
16+
* "filters"?: string, //A JSON encoded value of the filters (a `map[string][]string`) to
17+
* process on the list of build cache objects.
2318
*
2419
* Available filters:
2520
*
@@ -31,8 +26,7 @@ class BuildPrune extends \WebProject\DockerApi\Library\Generated\Runtime\Client\
3126
* - `inuse`
3227
* - `shared`
3328
* - `private`
34-
*
35-
* }
29+
* } $queryParameters
3630
*/
3731
public function __construct(array $queryParameters = [])
3832
{
@@ -62,10 +56,9 @@ public function getExtraHeaders(): array
6256
protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
6357
{
6458
$optionsResolver = parent::getQueryOptionsResolver();
65-
$optionsResolver->setDefined(['keep-storage', 'reserved-space', 'max-used-space', 'min-free-space', 'all', 'filters']);
59+
$optionsResolver->setDefined(['reserved-space', 'max-used-space', 'min-free-space', 'all', 'filters']);
6660
$optionsResolver->setRequired([]);
6761
$optionsResolver->setDefaults([]);
68-
$optionsResolver->addAllowedTypes('keep-storage', ['int']);
6962
$optionsResolver->addAllowedTypes('reserved-space', ['int']);
7063
$optionsResolver->addAllowedTypes('max-used-space', ['int']);
7164
$optionsResolver->addAllowedTypes('min-free-space', ['int']);
@@ -78,18 +71,18 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver
7871
/**
7972
* {@inheritdoc}
8073
*
81-
* @return \WebProject\DockerApi\Library\Generated\Model\BuildPrunePostResponse200|null
74+
* @return null
8275
*
8376
* @throws \WebProject\DockerApi\Library\Generated\Exception\BuildPruneInternalServerErrorException
8477
*/
8578
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
8679
{
8780
$status = $response->getStatusCode();
8881
$body = (string) $response->getBody();
89-
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos($contentType, 'application/json'))) {
90-
return $serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\BuildPrunePostResponse200', 'json');
82+
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
83+
return json_decode($body);
9184
}
92-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
85+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
9386
throw new \WebProject\DockerApi\Library\Generated\Exception\BuildPruneInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
9487
}
9588
}

generated/Endpoint/ConfigCreate.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
5252
{
5353
$status = $response->getStatusCode();
5454
$body = (string) $response->getBody();
55-
if ((null === $contentType) === false && (201 === $status && false !== mb_strpos($contentType, 'application/json'))) {
55+
if ((null === $contentType) === false && (201 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5656
return $serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\IDResponse', 'json');
5757
}
58-
if ((null === $contentType) === false && (409 === $status && false !== mb_strpos($contentType, 'application/json'))) {
58+
if ((null === $contentType) === false && (409 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5959
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigCreateConflictException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6060
}
61-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
61+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
6262
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigCreateInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6363
}
64-
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos($contentType, 'application/json'))) {
64+
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
6565
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigCreateServiceUnavailableException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6666
}
6767
}

generated/Endpoint/ConfigDelete.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
5252
if (204 === $status) {
5353
return null;
5454
}
55-
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos($contentType, 'application/json'))) {
55+
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5656
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigDeleteNotFoundException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
5757
}
58-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
58+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5959
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigDeleteInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6060
}
61-
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos($contentType, 'application/json'))) {
61+
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
6262
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigDeleteServiceUnavailableException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6363
}
6464
}

generated/Endpoint/ConfigInspect.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
4949
{
5050
$status = $response->getStatusCode();
5151
$body = (string) $response->getBody();
52-
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos($contentType, 'application/json'))) {
52+
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5353
return $serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\Config', 'json');
5454
}
55-
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos($contentType, 'application/json'))) {
55+
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5656
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigInspectNotFoundException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
5757
}
58-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
58+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
5959
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigInspectInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6060
}
61-
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos($contentType, 'application/json'))) {
61+
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
6262
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigInspectServiceUnavailableException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
6363
}
6464
}

generated/Endpoint/ConfigList.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ class ConfigList extends \WebProject\DockerApi\Library\Generated\Runtime\Client\
88
use \WebProject\DockerApi\Library\Generated\Runtime\Client\EndpointTrait;
99

1010
/**
11-
* @param array $queryParameters {
12-
*
13-
* @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to
14-
* process on the configs list.
11+
* @param array{
12+
* "filters"?: string, //A JSON encoded value of the filters (a `map[string][]string`) to
13+
* process on the configs list.
1514
*
1615
* Available filters:
1716
*
1817
* - `id=<config id>`
1918
* - `label=<key> or label=<key>=value`
2019
* - `name=<config name>`
2120
* - `names=<config name>`
22-
*
23-
* }
21+
* } $queryParameters
2422
*/
2523
public function __construct(array $queryParameters = [])
2624
{
@@ -70,13 +68,13 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
7068
{
7169
$status = $response->getStatusCode();
7270
$body = (string) $response->getBody();
73-
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos($contentType, 'application/json'))) {
71+
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
7472
return $serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\Config[]', 'json');
7573
}
76-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
74+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
7775
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigListInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
7876
}
79-
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos($contentType, 'application/json'))) {
77+
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
8078
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigListServiceUnavailableException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
8179
}
8280
}

generated/Endpoint/ConfigUpdate.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ class ConfigUpdate extends \WebProject\DockerApi\Library\Generated\Runtime\Clien
1010
protected $accept;
1111

1212
/**
13-
* @param string $id The ID or name of the config
13+
* @param string $id The ID or name of the config
1414
* @param \WebProject\DockerApi\Library\Generated\Model\ConfigSpec|null $requestBody
15-
* @param array $queryParameters {
16-
*
17-
* @var int $version The version number of the config object being updated. This is
18-
* required to avoid conflicting writes.
19-
*
20-
* }
21-
*
15+
* @param array{
16+
* "version": int, //The version number of the config object being updated. This is
17+
* required to avoid conflicting writes.
18+
* } $queryParameters
2219
* @param array $accept Accept content header application/json|text/plain
2320
*/
2421
public function __construct(string $id, ?\WebProject\DockerApi\Library\Generated\Model\ConfigSpec $requestBody = null, array $queryParameters = [], array $accept = [])
@@ -88,16 +85,16 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
8885
if (200 === $status) {
8986
return null;
9087
}
91-
if ((null === $contentType) === false && (400 === $status && false !== mb_strpos($contentType, 'application/json'))) {
88+
if ((null === $contentType) === false && (400 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
9289
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigUpdateBadRequestException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
9390
}
94-
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos($contentType, 'application/json'))) {
91+
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
9592
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigUpdateNotFoundException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
9693
}
97-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
94+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
9895
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigUpdateInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
9996
}
100-
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos($contentType, 'application/json'))) {
97+
if ((null === $contentType) === false && (503 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
10198
throw new \WebProject\DockerApi\Library\Generated\Exception\ConfigUpdateServiceUnavailableException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
10299
}
103100
}

generated/Endpoint/ContainerArchive.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ class ContainerArchive extends \WebProject\DockerApi\Library\Generated\Runtime\C
1212
/**
1313
* Get a tar archive of a resource in the filesystem of container id.
1414
*
15-
* @param string $id ID or name of the container
16-
* @param array $queryParameters {
17-
*
18-
* @var string $path Resource in the container’s filesystem to archive.
19-
* }
20-
*
15+
* @param string $id ID or name of the container
16+
* @param array{
17+
* "path": string, //Resource in the container’s filesystem to archive.
18+
* } $queryParameters
2119
* @param array $accept Accept content header application/x-tar|application/json
2220
*/
2321
public function __construct(string $id, array $queryParameters = [], array $accept = [])
@@ -78,7 +76,7 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
7876
}
7977
if (400 === $status) {
8078
}
81-
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos($contentType, 'application/json'))) {
79+
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
8280
throw new \WebProject\DockerApi\Library\Generated\Exception\ContainerArchiveNotFoundException($response);
8381
}
8482
if (500 === $status) {

generated/Endpoint/ContainerArchiveInfo.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ class ContainerArchiveInfo extends \WebProject\DockerApi\Library\Generated\Runti
1414
* a base64 - encoded JSON object with some filesystem header information
1515
* about the path.
1616
*
17-
* @param string $id ID or name of the container
18-
* @param array $queryParameters {
19-
*
20-
* @var string $path Resource in the container’s filesystem to archive.
21-
* }
22-
*
17+
* @param string $id ID or name of the container
18+
* @param array{
19+
* "path": string, //Resource in the container’s filesystem to archive.
20+
* } $queryParameters
2321
* @param array $accept Accept content header application/json|text/plain
2422
*/
2523
public function __construct(string $id, array $queryParameters = [], array $accept = [])
@@ -80,13 +78,13 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
8078
if (200 === $status) {
8179
return null;
8280
}
83-
if ((null === $contentType) === false && (400 === $status && false !== mb_strpos($contentType, 'application/json'))) {
81+
if ((null === $contentType) === false && (400 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
8482
throw new \WebProject\DockerApi\Library\Generated\Exception\ContainerArchiveInfoBadRequestException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
8583
}
86-
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos($contentType, 'application/json'))) {
84+
if ((null === $contentType) === false && (404 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
8785
throw new \WebProject\DockerApi\Library\Generated\Exception\ContainerArchiveInfoNotFoundException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
8886
}
89-
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos($contentType, 'application/json'))) {
87+
if ((null === $contentType) === false && (500 === $status && false !== mb_strpos(strtolower($contentType), 'application/json'))) {
9088
throw new \WebProject\DockerApi\Library\Generated\Exception\ContainerArchiveInfoInternalServerErrorException($serializer->deserialize($body, 'WebProject\DockerApi\Library\Generated\Model\ErrorResponse', 'json'), $response);
9189
}
9290
}

0 commit comments

Comments
 (0)