diff --git a/.github/workflows/update-specs-and-client-libraries.yaml b/.github/workflows/update-specs-and-client-libraries.yaml index df2586a5..43face33 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.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 }} diff --git a/generators/java/okhttp-gson/templates/SHA256SUM b/generators/java/okhttp-gson/templates/SHA256SUM index 067ec654..f19ba404 100644 --- a/generators/java/okhttp-gson/templates/SHA256SUM +++ b/generators/java/okhttp-gson/templates/SHA256SUM @@ -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 diff --git a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/api.mustache b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/api.mustache index c659d9b3..437067d6 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/api.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/api.mustache @@ -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; diff --git a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pojo.mustache b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pojo.mustache index 5e5a5d9b..1ab0b6a8 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pojo.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pojo.mustache @@ -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 @@ -148,7 +133,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isMap}} {{/isReadOnly}} - /** + /** {{#description}} * {{.}} {{/description}} @@ -165,7 +150,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} * @deprecated {{/deprecated}} - **/ + */ {{#deprecated}} @Deprecated {{/deprecated}} @@ -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 @@ -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); } diff --git a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pom.mustache b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pom.mustache index ba88c570..7fa22253 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pom.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pom.mustache @@ -444,13 +444,13 @@ {{^useJakartaEe}} 1.3.5 {{/useJakartaEe}} -{{#performBeanValidation}} + {{#performBeanValidation}} 3.0.3 -{{/performBeanValidation}} -{{#useBeanValidation}} + {{/performBeanValidation}} + {{#useBeanValidation}} 3.0.2 -{{/useBeanValidation}} - 5.10.0 + {{/useBeanValidation}} + 5.10.2 1.10.0 2.1.1 1.1.1 diff --git a/generators/python/urllib3/templates/SHA256SUM b/generators/python/urllib3/templates/SHA256SUM index c8a7d27b..a48d1b45 100644 --- a/generators/python/urllib3/templates/SHA256SUM +++ b/generators/python/urllib3/templates/SHA256SUM @@ -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 diff --git a/generators/python/urllib3/templates/configuration.mustache b/generators/python/urllib3/templates/configuration.mustache index 7cef1857..39318218 100644 --- a/generators/python/urllib3/templates/configuration.mustache +++ b/generators/python/urllib3/templates/configuration.mustache @@ -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: @@ -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 """ @@ -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 """ @@ -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 """ @@ -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 diff --git a/generators/python/urllib3/templates/rest.mustache b/generators/python/urllib3/templates/rest.mustache index 5ea2d1c1..e332a637 100644 --- a/generators/python/urllib3/templates/rest.mustache +++ b/generators/python/urllib3/templates/rest.mustache @@ -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, diff --git a/generators/ruby/faraday/templates/SHA256SUM b/generators/ruby/faraday/templates/SHA256SUM index e474fcb8..9dbbab9f 100644 --- a/generators/ruby/faraday/templates/SHA256SUM +++ b/generators/ruby/faraday/templates/SHA256SUM @@ -1,5 +1,5 @@ 631eea1aeb59eff826cd4975334d66bdf7ad14d3feacdf35ed5b07f33548981e ./Gemfile.mustache 88dc22838f416232553b387453a2ebecf01d66508d8657d5313320cc03ceb6a2 ./README.mustache -b9af426fa4b72082dad184722e97c61366cceab0d247b477b2834e38aa6c3411 ./configuration.mustache +0770a6caea12e1d33baf4eafc3bbbf5ec4325be84c776b64f966956c3e4e68eb ./configuration.mustache e66f0139c35c8b1d88c19787b2379ee9e6857ced963624c9a945ee68f3b41b2f ./gemspec.mustache diff --git a/generators/ruby/faraday/templates/configuration.mustache b/generators/ruby/faraday/templates/configuration.mustache index 096394b3..8011b627 100644 --- a/generators/ruby/faraday/templates/configuration.mustache +++ b/generators/ruby/faraday/templates/configuration.mustache @@ -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. # @@ -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) @@ -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]) diff --git a/generators/typescript-axios/templates/SHA256SUM b/generators/typescript-axios/templates/SHA256SUM index aa7bea21..c918a09d 100644 --- a/generators/typescript-axios/templates/SHA256SUM +++ b/generators/typescript-axios/templates/SHA256SUM @@ -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 diff --git a/generators/typescript-axios/templates/apiInner.mustache b/generators/typescript-axios/templates/apiInner.mustache index 51dfc34a..9ee07243 100644 --- a/generators/typescript-axios/templates/apiInner.mustache +++ b/generators/typescript-axios/templates/apiInner.mustache @@ -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}} diff --git a/shell/generate.sh b/shell/generate.sh index 36f2837f..05027844 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.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}}