From 912e94ed4525494b819459610f724ce28412b3e5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:08:20 +0000 Subject: [PATCH 1/4] chore(deps): update openapi-generator --- generators/build.gradle | 2 +- package.json | 2 +- scripts/pre-gen/generateOpenapitools.ts | 2 +- yarn.lock | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/generators/build.gradle b/generators/build.gradle index 3c4bb1031fc..89845ec9be4 100644 --- a/generators/build.gradle +++ b/generators/build.gradle @@ -11,7 +11,7 @@ repositories { } dependencies { - compileOnly 'org.openapitools:openapi-generator:7.8.0' + compileOnly 'org.openapitools:openapi-generator:7.9.0' } tasks.withType(JavaCompile) { diff --git a/package.json b/package.json index 9ce8c7eed5a..ac31fad3a85 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "website:build": "bash scripts/website/build.sh" }, "devDependencies": { - "@openapitools/openapi-generator-cli": "2.13.13", + "@openapitools/openapi-generator-cli": "2.14.0", "@redocly/cli": "1.25.5", "eslint": "8.57.1", "eslint-plugin-automation-custom": "1.0.0", diff --git a/scripts/pre-gen/generateOpenapitools.ts b/scripts/pre-gen/generateOpenapitools.ts index 3a4b962df9b..172f3e2483f 100644 --- a/scripts/pre-gen/generateOpenapitools.ts +++ b/scripts/pre-gen/generateOpenapitools.ts @@ -43,7 +43,7 @@ export async function generateOpenapitools( JSON.stringify( { 'generator-cli': { - version: '7.8.0', + version: '7.9.0', generators, }, }, diff --git a/yarn.lock b/yarn.lock index c184526346d..98aa9b70601 100644 --- a/yarn.lock +++ b/yarn.lock @@ -79,7 +79,7 @@ __metadata: version: 0.0.0-use.local resolution: "@algolia/api-client-automation@workspace:." dependencies: - "@openapitools/openapi-generator-cli": "npm:2.13.13" + "@openapitools/openapi-generator-cli": "npm:2.14.0" "@redocly/cli": "npm:1.25.5" eslint: "npm:8.57.1" eslint-plugin-automation-custom: "npm:1.0.0" @@ -1416,9 +1416,9 @@ __metadata: languageName: node linkType: hard -"@openapitools/openapi-generator-cli@npm:2.13.13": - version: 2.13.13 - resolution: "@openapitools/openapi-generator-cli@npm:2.13.13" +"@openapitools/openapi-generator-cli@npm:2.14.0": + version: 2.14.0 + resolution: "@openapitools/openapi-generator-cli@npm:2.14.0" dependencies: "@nestjs/axios": "npm:3.0.3" "@nestjs/common": "npm:10.4.3" @@ -1440,7 +1440,7 @@ __metadata: tslib: "npm:2.7.0" bin: openapi-generator-cli: main.js - checksum: 10/298735860feb5da01b46f5e0c85978ccdb4bb579515abe52f7a65dfc16ca04d713d8056725958fe75ccc3edd08d6677e7f13543e24bf9487bfa48851ddc36035 + checksum: 10/4229f94af263695b6e899b8cfa2ed8217611a15ebda91541c5c1449af03cd76da148bb9d8084ceb3767d5e75ecd1cb22c61bb4f3608ebf238392a6c75ddda42e languageName: node linkType: hard From e8f3a361fe64b3b405eb9302e28151efcf4721c9 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 14 Oct 2024 12:24:15 +0200 Subject: [PATCH 2/4] fix --- .../src/main/java/com/algolia/codegen/utils/ModelPruner.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java b/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java index 99b4ebb8839..f14a5e2584b 100644 --- a/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java +++ b/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java @@ -121,7 +121,8 @@ public static void removeOrphans(CodegenConfig config, OperationsMap operations, String templateName = config.modelTemplateFiles().keySet().iterator().next(); for (String modelName : toRemove) { - String filename = config.modelFilename(templateName, modelName); + String suffix = config.modelTemplateFiles().get(templateName); + String filename = config.modelFileFolder() + "/" + config.toModelFilename(modelName) + suffix; File file = new File(filename); if (file.exists()) { file.delete(); From adb632ff158658b5f099d07b953bf77366fc41eb Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 14 Oct 2024 14:20:42 +0200 Subject: [PATCH 3/4] bah super php --- .../algoliasearch-client-php/lib/Algolia.php | 22 ++++++++----------- .../algolia/codegen/utils/ModelPruner.java | 2 +- templates/php/api.mustache | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/clients/algoliasearch-client-php/lib/Algolia.php b/clients/algoliasearch-client-php/lib/Algolia.php index 07b705736ba..c64849aa5ea 100644 --- a/clients/algoliasearch-client-php/lib/Algolia.php +++ b/clients/algoliasearch-client-php/lib/Algolia.php @@ -3,12 +3,8 @@ namespace Algolia\AlgoliaSearch; use Algolia\AlgoliaSearch\Cache\NullCacheDriver; -use Algolia\AlgoliaSearch\Http\CurlHttpClient; -use Algolia\AlgoliaSearch\Http\GuzzleHttpClient; use Algolia\AlgoliaSearch\Http\HttpClientInterface; use Algolia\AlgoliaSearch\Log\DebugLogger; -use GuzzleHttp\Client; -use GuzzleHttp\ClientInterface; use Psr\Log\LoggerInterface; use Psr\SimpleCache\CacheInterface; @@ -19,19 +15,19 @@ final class Algolia /** * Holds an instance of the simple cache repository (PSR-16). * - * @var null|CacheInterface + * @var null|\Psr\SimpleCache\CacheInterface */ private static $cache; /** * Holds an instance of the logger (PSR-3). * - * @var null|LoggerInterface + * @var null|\Psr\Log\LoggerInterface */ private static $logger; /** - * @var HttpClientInterface + * @var \Algolia\AlgoliaSearch\Http\HttpClientInterface */ private static $httpClient; @@ -47,7 +43,7 @@ public static function isCacheEnabled() /** * Gets the cache instance. * - * @return CacheInterface + * @return \Psr\SimpleCache\CacheInterface */ public static function getCache() { @@ -69,7 +65,7 @@ public static function setCache(CacheInterface $cache) /** * Gets the logger instance. * - * @return LoggerInterface + * @return \Psr\Log\LoggerInterface */ public static function getLogger() { @@ -94,23 +90,23 @@ public static function getHttpClient() if (interface_exists('\GuzzleHttp\ClientInterface')) { if (defined('\GuzzleHttp\ClientInterface::VERSION')) { $guzzleVersion = (int) mb_substr( - Client::VERSION, + \GuzzleHttp\Client::VERSION, 0, 1 ); } else { - $guzzleVersion = ClientInterface::MAJOR_VERSION; + $guzzleVersion = \GuzzleHttp\ClientInterface::MAJOR_VERSION; } } if (null === self::$httpClient) { if (class_exists('\GuzzleHttp\Client') && 6 <= $guzzleVersion) { self::setHttpClient( - new GuzzleHttpClient() + new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient() ); } else { self::setHttpClient( - new CurlHttpClient() + new \Algolia\AlgoliaSearch\Http\CurlHttpClient() ); } } diff --git a/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java b/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java index f14a5e2584b..e89ecab8682 100644 --- a/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java +++ b/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java @@ -86,7 +86,7 @@ private void exploreGraph(OperationsMap operations) { } } for (CodegenParameter param : ope.allParams) { - CodegenModel paramType = getModel(param.baseType != null ? param.baseType : param.dataType); + CodegenModel paramType = getModel(param.baseType != null ? param.baseType : param.getSchema().getOpenApiType()); if (paramType != null) { visitedModels.add(paramType.name); } diff --git a/templates/php/api.mustache b/templates/php/api.mustache index 4c02e8dc7c6..8f38c2fba00 100644 --- a/templates/php/api.mustache +++ b/templates/php/api.mustache @@ -181,7 +181,7 @@ use Algolia\AlgoliaSearch\Exceptions\NotFoundException; {{/x-acl}} {{/vendorExtensions}} {{#allParams}} - * @param {{#isString}}string{{/isString}}{{#isLong}}int{{/isLong}}{{#isInteger}}int{{/isInteger}}{{#isBoolean}}bool{{/isBoolean}}{{^isString}}{{^isLong}}{{^isInteger}}{{^isBoolean}}array{{/isBoolean}}{{/isInteger}}{{/isLong}}{{/isString}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} + * @param {{#isString}}string{{/isString}}{{#isLong}}int{{/isLong}}{{#isInteger}}int{{/isInteger}}{{#isBoolean}}bool{{/isBoolean}}{{^isString}}{{^isLong}}{{^isInteger}}{{^isBoolean}}array{{/isBoolean}}{{/isInteger}}{{/isLong}}{{/isString}} ${{paramName}}{{#description}} {{{.}}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{#isModel}} {{#vars}} * - ${{paramName}}{{> arrayParam}} From 95aa4eb817ea4b09539d5639b8eff9d68355be69 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 14 Oct 2024 14:46:03 +0200 Subject: [PATCH 4/4] okay ? --- .../algoliasearch-client-php/lib/Algolia.php | 22 +++++++++++-------- .../algolia/codegen/utils/ModelPruner.java | 7 +++++- specs/common/schemas/IndexSettings.yml | 1 - 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/clients/algoliasearch-client-php/lib/Algolia.php b/clients/algoliasearch-client-php/lib/Algolia.php index c64849aa5ea..07b705736ba 100644 --- a/clients/algoliasearch-client-php/lib/Algolia.php +++ b/clients/algoliasearch-client-php/lib/Algolia.php @@ -3,8 +3,12 @@ namespace Algolia\AlgoliaSearch; use Algolia\AlgoliaSearch\Cache\NullCacheDriver; +use Algolia\AlgoliaSearch\Http\CurlHttpClient; +use Algolia\AlgoliaSearch\Http\GuzzleHttpClient; use Algolia\AlgoliaSearch\Http\HttpClientInterface; use Algolia\AlgoliaSearch\Log\DebugLogger; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; use Psr\Log\LoggerInterface; use Psr\SimpleCache\CacheInterface; @@ -15,19 +19,19 @@ final class Algolia /** * Holds an instance of the simple cache repository (PSR-16). * - * @var null|\Psr\SimpleCache\CacheInterface + * @var null|CacheInterface */ private static $cache; /** * Holds an instance of the logger (PSR-3). * - * @var null|\Psr\Log\LoggerInterface + * @var null|LoggerInterface */ private static $logger; /** - * @var \Algolia\AlgoliaSearch\Http\HttpClientInterface + * @var HttpClientInterface */ private static $httpClient; @@ -43,7 +47,7 @@ public static function isCacheEnabled() /** * Gets the cache instance. * - * @return \Psr\SimpleCache\CacheInterface + * @return CacheInterface */ public static function getCache() { @@ -65,7 +69,7 @@ public static function setCache(CacheInterface $cache) /** * Gets the logger instance. * - * @return \Psr\Log\LoggerInterface + * @return LoggerInterface */ public static function getLogger() { @@ -90,23 +94,23 @@ public static function getHttpClient() if (interface_exists('\GuzzleHttp\ClientInterface')) { if (defined('\GuzzleHttp\ClientInterface::VERSION')) { $guzzleVersion = (int) mb_substr( - \GuzzleHttp\Client::VERSION, + Client::VERSION, 0, 1 ); } else { - $guzzleVersion = \GuzzleHttp\ClientInterface::MAJOR_VERSION; + $guzzleVersion = ClientInterface::MAJOR_VERSION; } } if (null === self::$httpClient) { if (class_exists('\GuzzleHttp\Client') && 6 <= $guzzleVersion) { self::setHttpClient( - new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient() + new GuzzleHttpClient() ); } else { self::setHttpClient( - new \Algolia\AlgoliaSearch\Http\CurlHttpClient() + new CurlHttpClient() ); } } diff --git a/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java b/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java index e89ecab8682..0ad533fb883 100644 --- a/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java +++ b/generators/src/main/java/com/algolia/codegen/utils/ModelPruner.java @@ -86,7 +86,12 @@ private void exploreGraph(OperationsMap operations) { } } for (CodegenParameter param : ope.allParams) { - CodegenModel paramType = getModel(param.baseType != null ? param.baseType : param.getSchema().getOpenApiType()); + String paramName = param.baseType != null ? param.baseType : param.dataType; + // php has a fully qualified name for the parameter type + if (paramName.contains("\\")) { + paramName = paramName.substring(paramName.lastIndexOf("\\") + 1); + } + CodegenModel paramType = getModel(paramName); if (paramType != null) { visitedModels.add(paramType.name); } diff --git a/specs/common/schemas/IndexSettings.yml b/specs/common/schemas/IndexSettings.yml index 995ed8c0712..8ff1619c358 100644 --- a/specs/common/schemas/IndexSettings.yml +++ b/specs/common/schemas/IndexSettings.yml @@ -1035,7 +1035,6 @@ widgets: banners: description: banners defined in the merchandising studio for the given search. type: array - additionalProperties: false items: $ref: '#/banner'