Skip to content

Commit 3a23e71

Browse files
imonkiaalyx-dbjtreminio-dropbox
authored
Updating openapi generator for PHP to 7.12.0 (#473)
Co-authored-by: Monica Auriemma <reta@dropbox.com> Co-authored-by: Juan Treminio <juantreminio@dropbox.com>
1 parent 6c7fd89 commit 3a23e71

223 files changed

Lines changed: 2253 additions & 2198 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.

sdks/php/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,6 @@ apisupport@hellosign.com
447447
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
448448

449449
- API version: `3.0.0`
450-
- Package version: `1.8-dev`
451-
- Generator version: `7.8.0`
450+
- Package version: `1.8.1-dev`
451+
- Generator version: `7.12.0`
452452
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`

sdks/php/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8-dev
1+
1.8.1-dev

sdks/php/bin/copy-constants.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
6+
ini_set('display_errors', 1);
7+
ini_set('display_startup_errors', 1);
8+
error_reporting(E_ALL);
9+
10+
set_error_handler(function ($level, $msg) {
11+
echo "Error: {$msg}";
12+
exit(1);
13+
});
14+
15+
/**
16+
* Between openapi-generator v7.8.0 and v7.12.0 a change was made to the way
17+
* a few generators create constant names from values. The original way was
18+
* actually broken. For example "change-field-visibility" would generate a
19+
* constant name of "TYPE_FIELD_VISIBILITY", dropping the "change" part.
20+
*
21+
* The fix now generates the correct name, "TYPE_CHANGE_FIELD_VISIBILITY".
22+
* However, the fix also gets rid of the previous (incorrect) constant names,
23+
* making the fix a BC break.
24+
*
25+
* This simple script just adds the old constant names back, alongside the new
26+
* ones.
27+
*/
28+
class CopyConstants
29+
{
30+
public function run(): void
31+
{
32+
$file = __DIR__ . '/../src/Model/SubFormFieldRuleAction.php';
33+
$contents = file_get_contents($file);
34+
35+
$constant_1 = " public const TYPE_CHANGE_FIELD_VISIBILITY = 'change-field-visibility';";
36+
$replace_1 = implode("\n", [
37+
$constant_1,
38+
' public const TYPE_FIELD_VISIBILITY = self::TYPE_CHANGE_FIELD_VISIBILITY;',
39+
]);
40+
41+
$constant_2 = " public const TYPE_CHANGE_GROUP_VISIBILITY = 'change-group-visibility';";
42+
$replace_2 = implode("\n", [
43+
$constant_2,
44+
' public const TYPE_GROUP_VISIBILITY = self::TYPE_CHANGE_GROUP_VISIBILITY;',
45+
]);
46+
47+
$contents = str_replace(
48+
$constant_1,
49+
$replace_1,
50+
$contents,
51+
);
52+
53+
$contents = str_replace(
54+
$constant_2,
55+
$replace_2,
56+
$contents,
57+
);
58+
59+
file_put_contents($file, $contents);
60+
}
61+
}
62+
63+
$copier = new CopyConstants();
64+
$copier->run();

sdks/php/openapi-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ generatorName: php
22
additionalProperties:
33
packageName: dropbox/sign
44
packageVersion: "^1.8.0"
5-
artifactVersion: 1.8-dev
5+
artifactVersion: 1.8.1-dev
66
invokerPackage: "Dropbox\\Sign"
77
sortModelPropertiesByRequiredFlag: true
88
srcBasePath: src

sdks/php/run-build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rm -f "${DIR}/src/Model/"*.php
1919
docker run --rm \
2020
-v "${DIR}/:/local" \
2121
-v "${DIR}/openapi-sdk.yaml:/local/openapi-sdk.yaml" \
22-
openapitools/openapi-generator-cli:v7.8.0 generate \
22+
openapitools/openapi-generator-cli:v7.12.0 generate \
2323
-i "/local/openapi-sdk.yaml" \
2424
-c "/local/openapi-config.yaml" \
2525
-t "/local/templates" \
@@ -48,6 +48,9 @@ docker run --rm \
4848
-w "${WORKING_DIR}" \
4949
perl bash ./bin/scan_for
5050

51+
printf "Adding old-style constant names ...\n"
52+
bash "${DIR}/bin/php-8" ./bin/copy-constants.php
53+
5154
# avoid docker messing with permissions
5255
if [[ -z "$GITHUB_ACTIONS" ]]; then
5356
chmod 644 "${DIR}/README.md"

sdks/php/src/Api/AccountApi.php

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* The version of the OpenAPI document: 3.0.0
1616
* Contact: apisupport@hellosign.com
1717
* Generated by: https://openapi-generator.tech
18-
* Generator version: 7.8.0
18+
* Generator version: 7.12.0
1919
*/
2020

2121
/**
@@ -88,9 +88,9 @@ class AccountApi
8888
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
8989
*/
9090
public function __construct(
91-
Configuration $config = null,
92-
ClientInterface $client = null,
93-
HeaderSelector $selector = null,
91+
?Configuration $config = null,
92+
?ClientInterface $client = null,
93+
?HeaderSelector $selector = null,
9494
int $hostIndex = 0
9595
) {
9696
$this->client = $client ?: new Client();
@@ -194,19 +194,6 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr
194194

195195
$statusCode = $response->getStatusCode();
196196

197-
if ($statusCode < 200 || $statusCode > 299) {
198-
throw new ApiException(
199-
sprintf(
200-
'[%d] Error connecting to the API (%s)',
201-
$statusCode,
202-
(string)$request->getUri()
203-
),
204-
$statusCode,
205-
$response->getHeaders(),
206-
(string)$response->getBody()
207-
);
208-
}
209-
210197
$result = $this->handleRangeCodeResponse(
211198
$response,
212199
'4XX',
@@ -246,6 +233,19 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr
246233
];
247234
}
248235

236+
if ($statusCode < 200 || $statusCode > 299) {
237+
throw new ApiException(
238+
sprintf(
239+
'[%d] Error connecting to the API (%s)',
240+
$statusCode,
241+
(string)$request->getUri()
242+
),
243+
$statusCode,
244+
$response->getHeaders(),
245+
(string)$response->getBody()
246+
);
247+
}
248+
249249
$returnType = '\Dropbox\Sign\Model\AccountCreateResponse';
250250
if ($returnType === '\SplFileObject') {
251251
$content = $response->getBody(); // stream goes to serializer
@@ -481,14 +481,14 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_
481481
*
482482
* Get Account
483483
*
484-
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
485-
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
484+
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
485+
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
486486
*
487487
* @return Model\AccountGetResponse
488488
* @throws ApiException on non-2xx response or if the response body is not in the expected format
489489
* @throws InvalidArgumentException
490490
*/
491-
public function accountGet(string $account_id = null, string $email_address = null)
491+
public function accountGet(?string $account_id = null, ?string $email_address = null)
492492
{
493493
list($response) = $this->accountGetWithHttpInfo($account_id, $email_address);
494494
return $response;
@@ -499,16 +499,16 @@ public function accountGet(string $account_id = null, string $email_address = nu
499499
*
500500
* Get Account
501501
*
502-
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
503-
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
504-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
502+
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
503+
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
504+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
505505
*
506506
* @return array of Model\AccountGetResponse, HTTP status code, HTTP response headers (array of strings)
507507
* @throws ApiException on non-2xx response or if the response body is not in the expected format
508508
* @throws InvalidArgumentException
509509
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
510510
*/
511-
public function accountGetWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
511+
public function accountGetWithHttpInfo(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
512512
{
513513
$request = $this->accountGetRequest($account_id, $email_address, $contentType);
514514

@@ -535,19 +535,6 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_
535535

536536
$statusCode = $response->getStatusCode();
537537

538-
if ($statusCode < 200 || $statusCode > 299) {
539-
throw new ApiException(
540-
sprintf(
541-
'[%d] Error connecting to the API (%s)',
542-
$statusCode,
543-
(string)$request->getUri()
544-
),
545-
$statusCode,
546-
$response->getHeaders(),
547-
(string)$response->getBody()
548-
);
549-
}
550-
551538
$result = $this->handleRangeCodeResponse(
552539
$response,
553540
'4XX',
@@ -587,6 +574,19 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_
587574
];
588575
}
589576

577+
if ($statusCode < 200 || $statusCode > 299) {
578+
throw new ApiException(
579+
sprintf(
580+
'[%d] Error connecting to the API (%s)',
581+
$statusCode,
582+
(string)$request->getUri()
583+
),
584+
$statusCode,
585+
$response->getHeaders(),
586+
(string)$response->getBody()
587+
);
588+
}
589+
590590
$returnType = '\Dropbox\Sign\Model\AccountGetResponse';
591591
if ($returnType === '\SplFileObject') {
592592
$content = $response->getBody(); // stream goes to serializer
@@ -637,15 +637,15 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_
637637
*
638638
* Get Account
639639
*
640-
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
641-
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
642-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
640+
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
641+
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
642+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
643643
*
644644
* @return \GuzzleHttp\Promise\PromiseInterface
645645
* @throws InvalidArgumentException
646646
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
647647
*/
648-
public function accountGetAsync(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
648+
public function accountGetAsync(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
649649
{
650650
return $this->accountGetAsyncWithHttpInfo($account_id, $email_address, $contentType)
651651
->then(
@@ -660,15 +660,15 @@ function ($response) {
660660
*
661661
* Get Account
662662
*
663-
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
664-
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
665-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
663+
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
664+
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
665+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
666666
*
667667
* @return \GuzzleHttp\Promise\PromiseInterface
668668
* @throws InvalidArgumentException
669669
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
670670
*/
671-
public function accountGetAsyncWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
671+
public function accountGetAsyncWithHttpInfo(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
672672
{
673673
$returnType = '\Dropbox\Sign\Model\AccountGetResponse';
674674
$request = $this->accountGetRequest($account_id, $email_address, $contentType);
@@ -712,15 +712,15 @@ function ($exception) {
712712
/**
713713
* Create request for operation 'accountGet'
714714
*
715-
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
716-
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
717-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
715+
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
716+
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
717+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
718718
*
719719
* @return Request
720720
* @throws InvalidArgumentException
721721
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
722722
*/
723-
public function accountGetRequest(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
723+
public function accountGetRequest(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
724724
{
725725
$resourcePath = '/account';
726726
$formParams = [];
@@ -873,19 +873,6 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up
873873

874874
$statusCode = $response->getStatusCode();
875875

876-
if ($statusCode < 200 || $statusCode > 299) {
877-
throw new ApiException(
878-
sprintf(
879-
'[%d] Error connecting to the API (%s)',
880-
$statusCode,
881-
(string)$request->getUri()
882-
),
883-
$statusCode,
884-
$response->getHeaders(),
885-
(string)$response->getBody()
886-
);
887-
}
888-
889876
$result = $this->handleRangeCodeResponse(
890877
$response,
891878
'4XX',
@@ -925,6 +912,19 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up
925912
];
926913
}
927914

915+
if ($statusCode < 200 || $statusCode > 299) {
916+
throw new ApiException(
917+
sprintf(
918+
'[%d] Error connecting to the API (%s)',
919+
$statusCode,
920+
(string)$request->getUri()
921+
),
922+
$statusCode,
923+
$response->getHeaders(),
924+
(string)$response->getBody()
925+
);
926+
}
927+
928928
$returnType = '\Dropbox\Sign\Model\AccountGetResponse';
929929
if ($returnType === '\SplFileObject') {
930930
$content = $response->getBody(); // stream goes to serializer
@@ -1212,19 +1212,6 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve
12121212

12131213
$statusCode = $response->getStatusCode();
12141214

1215-
if ($statusCode < 200 || $statusCode > 299) {
1216-
throw new ApiException(
1217-
sprintf(
1218-
'[%d] Error connecting to the API (%s)',
1219-
$statusCode,
1220-
(string)$request->getUri()
1221-
),
1222-
$statusCode,
1223-
$response->getHeaders(),
1224-
(string)$response->getBody()
1225-
);
1226-
}
1227-
12281215
$result = $this->handleRangeCodeResponse(
12291216
$response,
12301217
'4XX',
@@ -1264,6 +1251,19 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve
12641251
];
12651252
}
12661253

1254+
if ($statusCode < 200 || $statusCode > 299) {
1255+
throw new ApiException(
1256+
sprintf(
1257+
'[%d] Error connecting to the API (%s)',
1258+
$statusCode,
1259+
(string)$request->getUri()
1260+
),
1261+
$statusCode,
1262+
$response->getHeaders(),
1263+
(string)$response->getBody()
1264+
);
1265+
}
1266+
12671267
$returnType = '\Dropbox\Sign\Model\AccountVerifyResponse';
12681268
if ($returnType === '\SplFileObject') {
12691269
$content = $response->getBody(); // stream goes to serializer

0 commit comments

Comments
 (0)