From db5a1b59681fa467b324b4116de24d88d56d7452 Mon Sep 17 00:00:00 2001 From: Davide Vacca <134616519+dvacca-onfido@users.noreply.github.com> Date: Wed, 19 Feb 2025 11:44:15 +0100 Subject: [PATCH] Update openapi generator version to v7.11.0 (was v7.10.0) (#160) * Update openapi generator version to v7.11.0 (was v7.10.0) * A few improvements in configuration --- .github/workflows/update-specs-and-client-libraries.yaml | 2 +- README.md | 1 + generators/common/config.yaml | 3 +++ generators/java/okhttp-gson/config.yaml | 2 -- generators/java/okhttp-gson/templates/SHA256SUM | 2 +- .../templates/libraries/okhttp-gson/ApiClient.mustache | 2 ++ generators/php/config.yaml | 1 - generators/php/templates/Configuration.mustache | 2 +- generators/php/templates/ObjectSerializer.mustache | 6 +++--- generators/php/templates/SHA256SUM | 6 +++--- generators/php/templates/model_generic.mustache | 9 ++++----- generators/python/urllib3/templates/SHA256SUM | 6 +++--- generators/python/urllib3/templates/api_client.mustache | 2 +- generators/python/urllib3/templates/pyproject.mustache | 4 ++-- generators/python/urllib3/templates/setup.mustache | 6 ------ generators/ruby/faraday/config.yaml | 1 - generators/ruby/faraday/exclusions.txt | 5 ++++- generators/typescript-axios/config.yaml | 1 - generators/typescript-axios/templates/SHA256SUM | 2 +- .../typescript-axios/templates/configuration.mustache | 7 +++++-- shell/generate.sh | 2 +- 21 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/update-specs-and-client-libraries.yaml b/.github/workflows/update-specs-and-client-libraries.yaml index 5e040113..d18f4345 100644 --- a/.github/workflows/update-specs-and-client-libraries.yaml +++ b/.github/workflows/update-specs-and-client-libraries.yaml @@ -76,7 +76,7 @@ jobs: python_version: ${{ steps.generator.outputs.python_urllib3_version }} ruby_version: ${{ steps.generator.outputs.ruby_faraday_version }} container: - image: openapitools/openapi-generator-cli:v7.10.0 + image: openapitools/openapi-generator-cli:v7.11.0 env: OPENAPI_GENERATOR_COMMAND: docker-entrypoint.sh BUMP_CLIENT_LIBRARY_VERSION: ${{ inputs.type-of-change }} diff --git a/README.md b/README.md index 56ceb046..9d56e91b 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ We recommend providing the generator with the options below (whenever available) ```yaml enumUnknownDefaultCase: true +removeEnumValuePrefix: true useOneOfDiscriminatorLookup: true legacyDiscriminatorBehavior: false disallowAdditionalPropertiesIfNotPresent: false diff --git a/generators/common/config.yaml b/generators/common/config.yaml index d0e4c540..6be6a340 100644 --- a/generators/common/config.yaml +++ b/generators/common/config.yaml @@ -5,6 +5,9 @@ library: "${GENERATOR_LIBRARY}" templateDir: generators/${GENERATOR}/templates outputDir: generated/artifacts/${GENERATOR} disallowAdditionalPropertiesIfNotPresent: false +enumUnknownDefaultCase: true +removeEnumValuePrefix: true +licenseName: MIT additionalProperties: apiVersion: v3.6 documentationUrl: https://documentation.onfido.com diff --git a/generators/java/okhttp-gson/config.yaml b/generators/java/okhttp-gson/config.yaml index 5ba86da0..e2ca7add 100644 --- a/generators/java/okhttp-gson/config.yaml +++ b/generators/java/okhttp-gson/config.yaml @@ -14,8 +14,6 @@ developerName: Onfido developerOrganization: Onfido developerOrganizationUrl: http://onfido.com hideGenerationTimestamp: true -enumUnknownDefaultCase: true -licenseName: MIT licenseUrl: https://opensource.org/license/mit scmConnection: scm:git:git://github.com/onfido/onfido-java.git scmDeveloperConnection: scm:git:git://github.com/onfido/onfido-java.git diff --git a/generators/java/okhttp-gson/templates/SHA256SUM b/generators/java/okhttp-gson/templates/SHA256SUM index 07114556..e03dd900 100644 --- a/generators/java/okhttp-gson/templates/SHA256SUM +++ b/generators/java/okhttp-gson/templates/SHA256SUM @@ -1,6 +1,6 @@ 16502193337397367078434a27f67edfc6410f4c06d12db876155885d6a49394 ./README.mustache -a82c17a026cf8055c3bcfe41b940b165b5fc7126c58283c4c557d8b9ec668950 ./libraries/okhttp-gson/ApiClient.mustache +31d82e31183e9a500a8ae415a288f6de4b7215f1ebe65c2afb791cd0d3b335d6 ./libraries/okhttp-gson/ApiClient.mustache a1de601140f7e476752a87ae96902d45b499c8f8383eced56c6322e61549bdac ./libraries/okhttp-gson/api.mustache 245137cb0e10389bbe3b2c3061f3c3baa95ae35575b5b2576e0042a3942b742a ./libraries/okhttp-gson/oneof_model.mustache 2c2d109d7248ff40bc3309afd1b0aed95c0c0fac12814fe3354075b6f2649322 ./libraries/okhttp-gson/pojo.mustache diff --git a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/ApiClient.mustache b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/ApiClient.mustache index da09e34c..91204d6e 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/ApiClient.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/ApiClient.mustache @@ -47,9 +47,11 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +{{#jsr310}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; +{{/jsr310}} import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; diff --git a/generators/php/config.yaml b/generators/php/config.yaml index 2f6ce1c3..b9fcbd1b 100644 --- a/generators/php/config.yaml +++ b/generators/php/config.yaml @@ -1,6 +1,5 @@ gitRepoId: onfido-php artifactVersion: ${CLIENT_LIBRARY_VERSION} -enumUnknownDefaultCase: true legacyDiscriminatorBehavior: false composerPackageName: onfido/api invokerPackage: Onfido diff --git a/generators/php/templates/Configuration.mustache b/generators/php/templates/Configuration.mustache index b31d962a..edc16edf 100644 --- a/generators/php/templates/Configuration.mustache +++ b/generators/php/templates/Configuration.mustache @@ -480,7 +480,7 @@ class Configuration * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/generators/php/templates/ObjectSerializer.mustache b/generators/php/templates/ObjectSerializer.mustache index 664eaaf0..cb5f6040 100644 --- a/generators/php/templates/ObjectSerializer.mustache +++ b/generators/php/templates/ObjectSerializer.mustache @@ -49,8 +49,8 @@ class ObjectSerializer * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -395,7 +395,7 @@ class ObjectSerializer * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ diff --git a/generators/php/templates/SHA256SUM b/generators/php/templates/SHA256SUM index c05cd4b7..6b975098 100644 --- a/generators/php/templates/SHA256SUM +++ b/generators/php/templates/SHA256SUM @@ -1,6 +1,6 @@ -bb92a3f3107664c296ebc45c75bff7c88abf8b765565f4656a05e24234cb6d67 ./Configuration.mustache -76386901de81eba7d06fa8be77fc23e319bf7deb904cce3eea7edab7bdfb55ad ./ObjectSerializer.mustache +49dde1f93f8776b42eb1403b543701d0b281cf3af7e87410347d75134c2d95a2 ./Configuration.mustache +527a44c59ebe56e5c04f2f9f62154dece24dd837bce65c6397022b2f2b23733e ./ObjectSerializer.mustache 8eebaed003795c011df87fecd1f89c630dd3f23282d80e7f407f62009e2cd0ee ./README.mustache -2d94750ad5d913f8b7fbba24681c7cc1d75e96c89ec46c379e6625c825b39020 ./model_generic.mustache +edaabf17b3ea7e18b4dff84940362c9571130aa64c5e79aa1af1063158b1b368 ./model_generic.mustache 37d3333c7c3dbc6f6bffe64ce076bc512a2a1e61e986738c8e023bb745168e9a ./phpunit.xml.mustache diff --git a/generators/php/templates/model_generic.mustache b/generators/php/templates/model_generic.mustache index 73344fb5..3a8ee01c 100644 --- a/generators/php/templates/model_generic.mustache +++ b/generators/php/templates/model_generic.mustache @@ -24,8 +24,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * @var string[] */ protected static $openAPITypes = [ - {{#allVars}}'{{name}}' => '{{{dataType}}}'{{^-last}}, - {{/-last}}{{/allVars}} + {{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}}, + {{/-last}}{{/vars}} ]; /** @@ -240,10 +240,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { {{#parentSchema}} parent::__construct($data); @@ -566,5 +566,4 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } - } diff --git a/generators/python/urllib3/templates/SHA256SUM b/generators/python/urllib3/templates/SHA256SUM index 56625658..521a72d0 100644 --- a/generators/python/urllib3/templates/SHA256SUM +++ b/generators/python/urllib3/templates/SHA256SUM @@ -1,8 +1,8 @@ 47fdf5141b3d999914c33faff1626c6ac2f00f87fcf9653814084f1dc67351d9 ./README.mustache 6a196e67020d765512f0c8c88afc39ef9d3cacdd50a9eba6731a6dbb1997c6e5 ./__init__package.mustache -50f1ab5d4640232a6efe52888a7664d60619d7edffc04bdf16fe6fd8c0070a95 ./api_client.mustache +1038b2cefa0ba55211bc9a53886d821a5dc97e84317122617ed8a0abe2c85c0c ./api_client.mustache 28300d01dcb6061c45c6d68cba198d9ea3243a2650e5859c1f95a3d88520ac3b ./configuration.mustache -f1311d8eea7bc28f5146b9a3cec52d8220e016cb6545c75242e8a11e6c6693d6 ./pyproject.mustache +8d8d062eb225ee17721483a1c8dca7ce31bceb52e9b1e32823f87a9610b8dc95 ./pyproject.mustache 47d0cfca6043fc2c8bd2b5a09704e22b6a412c9ed425c3a83b6ab719cc129986 ./rest.mustache -bdd482446d4f3601bebe6fb59dba40748d9e59dc709e9033a354802ff8187eeb ./setup.mustache +c7a48ed926b4b140adcc466a1ea29b8f7780b6019867639312debaac4a940776 ./setup.mustache diff --git a/generators/python/urllib3/templates/api_client.mustache b/generators/python/urllib3/templates/api_client.mustache index 77e0bc49..4951dd3e 100644 --- a/generators/python/urllib3/templates/api_client.mustache +++ b/generators/python/urllib3/templates/api_client.mustache @@ -525,7 +525,7 @@ class ApiClient: if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, str(value)) for value in v) + new_params.extend((k, quote(str(value))) for value in v) else: if collection_format == 'ssv': delimiter = ' ' diff --git a/generators/python/urllib3/templates/pyproject.mustache b/generators/python/urllib3/templates/pyproject.mustache index c9826770..31b23449 100644 --- a/generators/python/urllib3/templates/pyproject.mustache +++ b/generators/python/urllib3/templates/pyproject.mustache @@ -17,14 +17,14 @@ package-mode = false {{! added opti [tool.poetry.dependencies] python = "^3.8" -urllib3 = ">= 1.25.3 < 3.0.0" +urllib3 = ">= 1.25.3, < 3.0.0" python-dateutil = ">= 2.8.2" {{#asyncio}} aiohttp = ">= 3.8.4" aiohttp-retry = ">= 2.8.3" {{/asyncio}} {{#tornado}} -tornado = ">=4.2 <5" +tornado = ">=4.2, <5" {{/tornado}} {{#hasHttpSignatureMethods}} pem = ">= 19.3.0" diff --git a/generators/python/urllib3/templates/setup.mustache b/generators/python/urllib3/templates/setup.mustache index e8363240..dbd546a5 100644 --- a/generators/python/urllib3/templates/setup.mustache +++ b/generators/python/urllib3/templates/setup.mustache @@ -13,9 +13,6 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "{{{projectName}}}-python" {{! package name updated with -python suffix }} VERSION = "{{packageVersion}}" PYTHON_REQUIRES = ">= 3.8" -{{#apiInfo}} -{{#apis}} -{{#-last}} REQUIRES = [ "urllib3 >= 1.25.3, < 3.0.0", "python-dateutil >= 2.8.2", @@ -52,6 +49,3 @@ setup( """, # noqa: E501 package_data={"{{{packageName}}}": ["py.typed"]}, ) -{{/-last}} -{{/apis}} -{{/apiInfo}} diff --git a/generators/ruby/faraday/config.yaml b/generators/ruby/faraday/config.yaml index 76e607b0..280ce729 100644 --- a/generators/ruby/faraday/config.yaml +++ b/generators/ruby/faraday/config.yaml @@ -1,6 +1,5 @@ gitRepoId: onfido-ruby gemVersion: ${CLIENT_LIBRARY_VERSION} -enumUnknownDefaultCase: true gemName: onfido gemHomepage: https://github.com/onfido/onfido-ruby gemLicense: MIT diff --git a/generators/ruby/faraday/exclusions.txt b/generators/ruby/faraday/exclusions.txt index 3d8d1038..998025ad 100644 --- a/generators/ruby/faraday/exclusions.txt +++ b/generators/ruby/faraday/exclusions.txt @@ -1,4 +1,7 @@ /spec/ /git_push.sh /docs/ -/.travis.yml \ No newline at end of file +/.travis.yml + +# For local development +/vendor/bundle diff --git a/generators/typescript-axios/config.yaml b/generators/typescript-axios/config.yaml index 7670c16d..03ab88fc 100644 --- a/generators/typescript-axios/config.yaml +++ b/generators/typescript-axios/config.yaml @@ -1,7 +1,6 @@ gitRepoId: onfido-node npmName: "@onfido/api" npmVersion: ${CLIENT_LIBRARY_VERSION} -enumUnknownDefaultCase: true supportsES6: true withNodeImports: true axiosVersion: ^1.7.4 diff --git a/generators/typescript-axios/templates/SHA256SUM b/generators/typescript-axios/templates/SHA256SUM index 8d19cd98..54a84b22 100644 --- a/generators/typescript-axios/templates/SHA256SUM +++ b/generators/typescript-axios/templates/SHA256SUM @@ -2,7 +2,7 @@ e13ee7c0cad9a79bab00e8b2a7942bc5a78f63115ece3dfd71a6472bdb02dd22 ./README.mustache 3a077701e62c4d0942657c78cf0116cbe58436e34d723d81aaed7ed0d56d2ed1 ./api.mustache 244ce751d42c4d1ab2eadb28dbe6744e4e5a7c934ffde2eae9bf25b77ef12d49 ./apiInner.mustache -d8d68213e1a9a9983f89f688aaf31360f69d34a871cab4fc94f59a40279b13d9 ./configuration.mustache +fd915ea5c76b1a1c7911d02f4d2260815ec3c8f61073ee5ac443f1d534c28d29 ./configuration.mustache 5030fcd1954b4d981f2d06fce4900fe29c97c7b74ee66f2eb5f45e81b9252a94 ./index.mustache ddc15a816c127736387e9ad99dfa9e965c587ff80b599b286e0d614e69c602e0 ./package.mustache 89b381b068d1849cc98721643c923ee153a5bdd69e19306dda59114ba0a2e243 ./tsconfig.mustache diff --git a/generators/typescript-axios/templates/configuration.mustache b/generators/typescript-axios/templates/configuration.mustache index 9285e059..d892b8b1 100644 --- a/generators/typescript-axios/templates/configuration.mustache +++ b/generators/typescript-axios/templates/configuration.mustache @@ -91,10 +91,13 @@ export class Configuration { this.apiKey = 'Token token=' + param.apiToken; this.basePath = param.basePath || BASE_PATH.replace('.eu.', `.${Region[param.region || Region.EU].toLowerCase()}.`); + {{! set a default timeout value, add baseOptions before headers, injiect form-data and fix user-agent }} this.baseOptions = {...{ timeout: 30_000 }, ...param.baseOptions, - ...{ headers: {...param.baseOptions?.headers, - ...{'User-Agent': '{{httpUserAgent}}'}}}}; + headers: {...param.baseOptions?.headers, + 'User-Agent': "{{httpUserAgent}}" + }, + }; this.formDataCtor = param.formDataCtor || require('form-data'); // Injiect form data constructor (if needed) } diff --git a/shell/generate.sh b/shell/generate.sh index 469433d3..b246f9d7 100755 --- a/shell/generate.sh +++ b/shell/generate.sh @@ -10,7 +10,7 @@ COMMON_CONFIG_FILE="generators/common/config.yaml" GENERATORS=${*:-`find generators -name 'config.yaml' -exec dirname {} \; | sed 's/generators\///'`} GENERATED_CONFIG_FILES="" -OPENAPI_GENERATOR_VERSION=${OPENAPI_GENERATOR_VERSION:-v7.10.0} +OPENAPI_GENERATOR_VERSION=${OPENAPI_GENERATOR_VERSION:-v7.11.0} OPENAPI_GENERATOR_COMMAND=${OPENAPI_GENERATOR_COMMAND:-\ docker run --rm -v "$(pwd):/local" -w /local \ openapitools/openapi-generator-cli:${OPENAPI_GENERATOR_VERSION}}