Skip to content

Commit

Permalink
Migrate to OpenAPI generator v7.7.0 (was v7.6.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvacca-onfido committed Oct 16, 2024
1 parent a47395f commit 7b6e844
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-specs-and-client-libraries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0
image: openapitools/openapi-generator-cli:v7.7.0
env:
OPENAPI_GENERATOR_COMMAND: docker-entrypoint.sh
BUMP_CLIENT_LIBRARY_VERSION: ${{ inputs.type-of-change }}
Expand Down
6 changes: 3 additions & 3 deletions generators/java/okhttp-gson/templates/SHA256SUM
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

16502193337397367078434a27f67edfc6410f4c06d12db876155885d6a49394 ./README.mustache
7b635a5f3fcc4cb2ace38f0dd0ca8252a78090e592a6c35fe5a08f7bc407ef6b ./libraries/okhttp-gson/ApiClient.mustache
133ba02513dba3fa805f364770b5a2fcc87a4c6ed0cf7afd322376e03143859f ./libraries/okhttp-gson/api.mustache
aeab98c355869f50b770c6ae6586ea4a4967da9932b1ea33dae5460282edbfa9 ./libraries/okhttp-gson/api.mustache
0e77feaf2d6b0818194161ac7e621189aa6e7900b45d46fa4ff1232894bb1a7a ./libraries/okhttp-gson/oneof_model.mustache
9a768c6d6b3ffcf21e5aa73e2d23ca524deb4b8503e73b0bc7e48e54403e5afb ./libraries/okhttp-gson/pojo.mustache
e83ff873cc6a5a7e064b4732ab4bfbb3fa32660d015b9ca1b6bdb5884335c506 ./libraries/okhttp-gson/pom.mustache
0a32d7eb71b3604d8eb295f39a0da854ea602ea9c95bf0539dc0c25942374cf0 ./libraries/okhttp-gson/pojo.mustache
63aed7ca8c0c5d881ad2c7845d33804f17280420d31bcdbcbcf8ae4f3f55e741 ./libraries/okhttp-gson/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import io.swagger.v3.oas.models.parameters.Parameter;
import java.io.IOException;

{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
{{/useBeanValidation}}
{{#performBeanValidation}}
import {{javaxPackage}}.validation.ConstraintViolation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/isEnum}}
public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}";
{{#withXml}}
{{#isXmlAttribute}}
@XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
{{/isXmlAttribute}}
{{^isXmlAttribute}}
{{^isContainer}}
@XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
{{/isContainer}}
{{#isContainer}}
// Is a container wrapped={{isXmlWrapped}}
{{#items}}
// items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}}
// items.example={{example}} items.type={{dataType}}
@XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
{{/items}}
{{#isXmlWrapped}}
@XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
{{/isXmlWrapped}}
{{/isContainer}}
{{/isXmlAttribute}}
@Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
{{#isXmlWrapped}}
@XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
{{/isXmlWrapped}}
{{/withXml}}
{{#deprecated}}
@Deprecated
Expand Down Expand Up @@ -148,7 +133,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/isMap}}

{{/isReadOnly}}
/**
/**
{{#description}}
* {{.}}
{{/description}}
Expand All @@ -165,7 +150,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#deprecated}}
* @deprecated
{{/deprecated}}
**/
*/
{{#deprecated}}
@Deprecated
{{/deprecated}}
Expand Down Expand Up @@ -354,12 +339,12 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/requiredVars}}
}

/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to {{classname}}
*/
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to {{classname}}
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!{{classname}}.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
Expand Down Expand Up @@ -585,22 +570,22 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
}
{{/hasChildren}}

/**
* Create an instance of {{classname}} given an JSON string
*
* @param jsonString JSON string
* @return An instance of {{classname}}
* @throws IOException if the JSON string is invalid with respect to {{classname}}
*/
/**
* Create an instance of {{classname}} given an JSON string
*
* @param jsonString JSON string
* @return An instance of {{classname}}
* @throws IOException if the JSON string is invalid with respect to {{classname}}
*/
public static {{{classname}}} fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, {{{classname}}}.class);
}

/**
* Convert an instance of {{classname}} to an JSON string
*
* @return JSON string
*/
/**
* Convert an instance of {{classname}} to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,13 @@
{{^useJakartaEe}}
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{/useJakartaEe}}
{{#performBeanValidation}}
{{#performBeanValidation}}
<jakarta.el-version>3.0.3</jakarta.el-version>
{{/performBeanValidation}}
{{#useBeanValidation}}
{{/performBeanValidation}}
{{#useBeanValidation}}
<beanvalidation-version>3.0.2</beanvalidation-version>
{{/useBeanValidation}}
<junit-version>5.10.0</junit-version>
{{/useBeanValidation}}
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
<javax.ws.rs-api-version>2.1.1</javax.ws.rs-api-version>
<jsr311-api-version>1.1.1</jsr311-api-version>
Expand Down
4 changes: 2 additions & 2 deletions generators/python/urllib3/templates/SHA256SUM
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

47fdf5141b3d999914c33faff1626c6ac2f00f87fcf9653814084f1dc67351d9 ./README.mustache
6a196e67020d765512f0c8c88afc39ef9d3cacdd50a9eba6731a6dbb1997c6e5 ./__init__package.mustache
e589dfcb5f8243b7e87998c012262d20db37c8dd985759232aad5e846bccd2bb ./configuration.mustache
2001a188ffeaeb931e2272f56445bfdb83f078bf2deeb7868021d8a321c3ce8f ./configuration.mustache
5b0f4e5cf6a265530e0c63089e02c61b4b43e20a99859e615a4add2017479cdb ./pyproject.mustache
36cae3e3b78cb80e1bdcc3c3f30ff58dc03d04561ed1559a92bfb07b934a8cf2 ./rest.mustache
69560729b13101b6b24b76497e63fa28a813772c17efc9e62b49976e083a9f31 ./rest.mustache
911e968c3503210fccd044a47de5dc833564ac41d08e3f386cd88d772cfa1488 ./setup.mustache
15 changes: 13 additions & 2 deletions generators/python/urllib3/templates/configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.

{{#hasAuthMethods}}
:Example:
Expand Down Expand Up @@ -149,7 +150,11 @@ conf = {{{packageName}}}.Configuration(
{{/hasHttpSignatureMethods}}
server_index=None,
server_operation_index=None, server_operation_variables=None,
ignore_operation_servers=False,
ssl_ca_cert=None,
retries=None,
*,
debug: Optional[bool] = None
) -> None:
"""Constructor
"""
Expand All @@ -166,6 +171,9 @@ conf = {{{packageName}}}.Configuration(
self.server_operation_variables = server_operation_variables or {}
"""Default server variables
"""
self.ignore_operation_servers = ignore_operation_servers
"""Ignore operation servers
"""
self.temp_folder_path = None
"""Temp file folder for downloading files
"""
Expand Down Expand Up @@ -203,7 +211,10 @@ conf = {{{packageName}}}.Configuration(
self.logger_file = None
"""Debug file location
"""
self.debug = False
if debug is not None:
self.debug = debug
else:
self.__debug = False
"""Debug switch
"""

Expand Down Expand Up @@ -254,7 +265,7 @@ conf = {{{packageName}}}.Configuration(
self.safe_chars_for_path_param = ''
"""Safe chars for path_param
"""
self.retries = None
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""
# Enable client side validation
Expand Down
2 changes: 1 addition & 1 deletion generators/python/urllib3/templates/rest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class RESTClientObject:
):
request_body = None
if body is not None:
request_body = json.dumps(body)
request_body = json.dumps(body{{#setEnsureAsciiToFalse}}, ensure_ascii=False{{/setEnsureAsciiToFalse}})
r = self.pool_manager.request(
method,
url,
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/faraday/templates/SHA256SUM
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

631eea1aeb59eff826cd4975334d66bdf7ad14d3feacdf35ed5b07f33548981e ./Gemfile.mustache
88dc22838f416232553b387453a2ebecf01d66508d8657d5313320cc03ceb6a2 ./README.mustache
b9af426fa4b72082dad184722e97c61366cceab0d247b477b2834e38aa6c3411 ./configuration.mustache
0770a6caea12e1d33baf4eafc3bbbf5ec4325be84c776b64f966956c3e4e68eb ./configuration.mustache
e66f0139c35c8b1d88c19787b2379ee9e6857ced963624c9a945ee68f3b41b2f ./gemspec.mustache
10 changes: 10 additions & 0 deletions generators/ruby/faraday/templates/configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ module {{moduleName}}
# @return [true, false]
attr_accessor :debugging

# Set this to ignore operation servers for the API client. This is useful when you need to
# send requests to a different server than the one specified in the OpenAPI document.
# Will default to the base url defined in the spec but can be overridden by setting
# `scheme`, `host`, `base_path` directly.
# Default to false.
# @return [true, false]
attr_accessor :ignore_operation_servers

# Defines the logger used for debugging.
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
#
Expand Down Expand Up @@ -157,6 +165,7 @@ module {{moduleName}}
@configure_session_blocks = []
{{/isHttpx}}
@debugging = false
@ignore_operation_servers = false
@inject_format = false
@force_ending_format = false
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
Expand Down Expand Up @@ -193,6 +202,7 @@ module {{moduleName}}

# Returns base URL for specified operation based on server settings
def base_url(operation = nil)
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
if operation_server_settings.key?(operation) then
index = server_operation_index.fetch(operation, server_index)
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript-axios/templates/SHA256SUM
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

e13ee7c0cad9a79bab00e8b2a7942bc5a78f63115ece3dfd71a6472bdb02dd22 ./README.mustache
3a077701e62c4d0942657c78cf0116cbe58436e34d723d81aaed7ed0d56d2ed1 ./api.mustache
0f4ea3b4db29a3bbada4c5ad5e4b08fa598305ba09aa29d237edee1634f8805b ./apiInner.mustache
9348f10f4fae1b858223f3cd5e33a2f399061a43fb1882959627f0b52d9e0ea1 ./apiInner.mustache
d8d68213e1a9a9983f89f688aaf31360f69d34a871cab4fc94f59a40279b13d9 ./configuration.mustache
5030fcd1954b4d981f2d06fce4900fe29c97c7b74ee66f2eb5f45e81b9252a94 ./index.mustache
28f5e210e99474200c8e5f13e4f2374c1556406eb71c15e808d81913000cd549 ./package.mustache
Expand Down
4 changes: 2 additions & 2 deletions generators/typescript-axios/templates/apiInner.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{/contentType}}
{{^contentType}}
{{paramName}}.forEach((element) => {
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', element as any);
})
{{/contentType}}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
{{/isCollectionFormatMulti}}
}{{/isArray}}
{{^isArray}}
Expand Down
2 changes: 1 addition & 1 deletion shell/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0}
OPENAPI_GENERATOR_VERSION=${OPENAPI_GENERATOR_VERSION:-v7.7.0}
OPENAPI_GENERATOR_COMMAND=${OPENAPI_GENERATOR_COMMAND:-\
docker run --rm -v "$(pwd):/local" -w /local \
openapitools/openapi-generator-cli:${OPENAPI_GENERATOR_VERSION}}
Expand Down

0 comments on commit 7b6e844

Please sign in to comment.