diff --git a/.github/workflows/update-specs-and-client-libraries.yaml b/.github/workflows/update-specs-and-client-libraries.yaml index e6a24d73..5e040113 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.9.0 + image: openapitools/openapi-generator-cli:v7.10.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 dcbce58d..07114556 100644 --- a/generators/java/okhttp-gson/templates/SHA256SUM +++ b/generators/java/okhttp-gson/templates/SHA256SUM @@ -1,7 +1,7 @@ 16502193337397367078434a27f67edfc6410f4c06d12db876155885d6a49394 ./README.mustache -9866a9e83531d72f155a0fdea252cfe5d340deea3d6e2da7eb64c941dc88577a ./libraries/okhttp-gson/ApiClient.mustache -7db4829dd39d1e769cfe38a07e976684f71e5db4077030ea1b423703958da223 ./libraries/okhttp-gson/api.mustache -0e77feaf2d6b0818194161ac7e621189aa6e7900b45d46fa4ff1232894bb1a7a ./libraries/okhttp-gson/oneof_model.mustache -f20b6129f3b473ecaa4e39f760bb1028d6c1f832928fa2f460131e2c54d66ed0 ./libraries/okhttp-gson/pojo.mustache -2f63581598dd2ba1373a51c0c3dfbcfa2a43d25f278a048c04c6679ef03f1224 ./libraries/okhttp-gson/pom.mustache +a82c17a026cf8055c3bcfe41b940b165b5fc7126c58283c4c557d8b9ec668950 ./libraries/okhttp-gson/ApiClient.mustache +a1de601140f7e476752a87ae96902d45b499c8f8383eced56c6322e61549bdac ./libraries/okhttp-gson/api.mustache +245137cb0e10389bbe3b2c3061f3c3baa95ae35575b5b2576e0042a3942b742a ./libraries/okhttp-gson/oneof_model.mustache +2c2d109d7248ff40bc3309afd1b0aed95c0c0fac12814fe3354075b6f2649322 ./libraries/okhttp-gson/pojo.mustache +a3b6ce241edbd6e22b84f54f4c07c59454bc7be4ede93b33c5f034125f97ead6 ./libraries/okhttp-gson/pom.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 eb289707..da09e34c 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/ApiClient.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/ApiClient.mustache @@ -999,7 +999,7 @@ public class ApiClient { } {{/dynamicOperations}} - /** + /** * Formats the specified free-form query parameters to a list of {@code Pair} objects. * * @param value The free-form query parameters. @@ -1013,7 +1013,7 @@ public class ApiClient { return params; } - @SuppressWarnings("unchecked"){{! Fix unchecked cast warning }} + @SuppressWarnings("unchecked") final Map valuesMap = (Map) value; for (Map.Entry entry : valuesMap.entrySet()) { 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 52817018..1e7cd3bd 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/api.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/api.mustache @@ -99,7 +99,8 @@ public class {{classname}} { * @throws ApiException If fail to serialize the request body object {{#responses.0}} * @http.response.details - +
+ {{#responses}} @@ -181,12 +182,6 @@ public class {{classname}} { {{/isQueryParam}} {{/constantParams}} - {{#headerParams}} - if ({{paramName}} != null) { - localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); - } - - {{/headerParams}} {{#constantParams}} {{#isHeaderParam}} // Set client side default value of Header Param "{{baseName}}". @@ -231,6 +226,15 @@ public class {{classname}} { if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } + {{^dynamicOperations}} + {{#headerParams}} + + if ({{paramName}} != null) { + localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/headerParams}} + {{/dynamicOperations}} String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); @@ -288,7 +292,8 @@ public class {{classname}} { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -328,7 +333,8 @@ public class {{classname}} { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -396,7 +402,8 @@ public class {{classname}} { * @throws ApiException If fail to process the API call, e.g. serializing the request body object {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -456,7 +463,8 @@ public class {{classname}} { * @throws ApiException If fail to serialize the request body object {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -480,7 +488,8 @@ public class {{classname}} { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -512,7 +521,8 @@ public class {{classname}} { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -544,7 +554,8 @@ public class {{classname}} { * @throws ApiException If fail to process the API call, e.g. serializing the request body object {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} @@ -570,7 +581,8 @@ public class {{classname}} { * @return API{{operationId}}Request {{#responses.0}} * @http.response.details -
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+
+ {{#responses}} diff --git a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/oneof_model.mustache b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/oneof_model.mustache index 7c00259b..060dbfa1 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/oneof_model.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/oneof_model.mustache @@ -378,7 +378,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im {{#composedSchemas}} {{#oneOf}} - {{^vendorExtensions.x-duplicated-data-type}} + {{^vendorExtensions.x-duplicated-data-type-ignoring-erasure}} /** * Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`, * the ClassCastException will be thrown. @@ -391,10 +391,10 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException { return ({{{dataType}}})super.getActualInstance(); } - {{/vendorExtensions.x-duplicated-data-type}} + + {{/vendorExtensions.x-duplicated-data-type-ignoring-erasure}} {{/oneOf}} {{/composedSchemas}} - /** * Validates the JSON Element and throws an exception if issues found * 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 57598cdb..2e98eef1 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pojo.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pojo.mustache @@ -70,6 +70,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#vendorExtensions.x-field-extra-annotation}} {{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}} + {{>nullable_var_annotations}} {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/vars}} @@ -106,7 +107,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} @Deprecated {{/deprecated}} - public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + public {{classname}} {{name}}({{>nullable_var_annotations}} {{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; return this; } @@ -153,17 +154,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} @Deprecated {{/deprecated}} -{{#required}} -{{#isNullable}} - @{{javaxPackage}}.annotation.Nullable -{{/isNullable}} -{{^isNullable}} - @{{javaxPackage}}.annotation.Nonnull -{{/isNullable}} -{{/required}} -{{^required}} - @{{javaxPackage}}.annotation.Nullable -{{/required}} + {{>nullable_var_annotations}} {{#useBeanValidation}} {{>beanValidation}} {{/useBeanValidation}} @@ -183,7 +174,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{^isReadOnly}} {{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} {{/vendorExtensions.x-setter-extra-annotation}}{{#deprecated}} @Deprecated -{{/deprecated}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { +{{/deprecated}} public void {{setter}}({{>nullable_var_annotations}} {{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; } {{/isReadOnly}} 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 f908f797..90ff8bf4 100644 --- a/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pom.mustache +++ b/generators/java/okhttp-gson/templates/libraries/okhttp-gson/pom.mustache @@ -426,7 +426,7 @@ {{/swagger2AnnotationLibrary}} 4.12.02.10.1 - 3.14.0 + 3.17.0 {{#openApiNullable}} 0.2.6 {{/openApiNullable}} diff --git a/generators/python/urllib3/templates/SHA256SUM b/generators/python/urllib3/templates/SHA256SUM index ea9bf349..56625658 100644 --- a/generators/python/urllib3/templates/SHA256SUM +++ b/generators/python/urllib3/templates/SHA256SUM @@ -2,7 +2,7 @@ 47fdf5141b3d999914c33faff1626c6ac2f00f87fcf9653814084f1dc67351d9 ./README.mustache 6a196e67020d765512f0c8c88afc39ef9d3cacdd50a9eba6731a6dbb1997c6e5 ./__init__package.mustache 50f1ab5d4640232a6efe52888a7664d60619d7edffc04bdf16fe6fd8c0070a95 ./api_client.mustache -2001a188ffeaeb931e2272f56445bfdb83f078bf2deeb7868021d8a321c3ce8f ./configuration.mustache -5e1131256ad0adbae73204efd8932db30b808b99cfd2ffde6be6ec60ed690fac ./pyproject.mustache +28300d01dcb6061c45c6d68cba198d9ea3243a2650e5859c1f95a3d88520ac3b ./configuration.mustache +f1311d8eea7bc28f5146b9a3cec52d8220e016cb6545c75242e8a11e6c6693d6 ./pyproject.mustache 47d0cfca6043fc2c8bd2b5a09704e22b6a412c9ed425c3a83b6ab719cc129986 ./rest.mustache bdd482446d4f3601bebe6fb59dba40748d9e59dc709e9033a354802ff8187eeb ./setup.mustache diff --git a/generators/python/urllib3/templates/configuration.mustache b/generators/python/urllib3/templates/configuration.mustache index 39318218..87e3338e 100644 --- a/generators/python/urllib3/templates/configuration.mustache +++ b/generators/python/urllib3/templates/configuration.mustache @@ -3,16 +3,17 @@ {{>partial_header}} import copy +import http.client as httplib import logging from logging import FileHandler {{^asyncio}} import multiprocessing {{/asyncio}} import sys -from typing import Optional -import urllib3 +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict +from typing_extensions import NotRequired, Self -import http.client as httplib +import urllib3 {{! Added block of code - BEGIN }} from enum import Enum @@ -24,6 +25,9 @@ class Region(Enum): {{! Added block of code - END }} +{{#hasHttpSignatureMethods}} +from {{packageName}}.signing import HttpSigningConfiguration +{{/hasHttpSignatureMethods}} JSON_SCHEMA_VALIDATION_KEYWORDS = { 'multipleOf', 'maximum', 'exclusiveMaximum', @@ -31,6 +35,130 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = { 'minLength', 'pattern', 'maxItems', 'minItems' } +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { +{{#authMethods}} +{{#isOAuth}} + "{{name}}": OAuth2AuthSetting, +{{/isOAuth}} +{{#isApiKey}} + "{{name}}": APIKeyAuthSetting, +{{/isApiKey}} +{{#isBasic}} + {{#isBasicBasic}} + "{{name}}": BasicAuthSetting, + {{/isBasicBasic}} + {{#isBasicBearer}} + {{#bearerFormat}} + "{{name}}": BearerFormatAuthSetting, + {{/bearerFormat}} + {{^bearerFormat}} + "{{name}}": BearerAuthSetting, + {{/bearerFormat}} + {{/isBasicBearer}} + {{#isHttpSignature}} + "{{name}}": HTTPSignatureAuthSetting, + {{/isHttpSignature}} +{{/isBasic}} +{{/authMethods}} + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + class Configuration: """This class contains various settings of the API client. @@ -138,24 +266,27 @@ conf = {{{packageName}}}.Configuration( {{/hasAuthMethods}} """ - _default = None + _default: ClassVar[Optional[Self]] = None {{! api_key, api_key_prefix, username, password, access_token and server_variables removed, api_token, region and timeout added }} - def __init__(self, host=None, - api_token=None, - region=Region.EU, - timeout=None, + def __init__( + self, + host: Optional[str]=None, + api_token: Optional[str]=None, + region: Optional[Region]=Region.EU, + timeout: Optional[urllib3.util.Timeout]=None, {{#hasHttpSignatureMethods}} - signing_info=None, + signing_info: Optional[HttpSigningConfiguration]=None, {{/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: + server_index: Optional[int]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + *, + debug: Optional[bool] = None, + ) -> None: """Constructor """ self._base_path = "{{{basePath}}}" if host is None else host @@ -283,7 +414,7 @@ conf = {{{packageName}}}.Configuration( """date format """ - def __deepcopy__(self, memo): + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result @@ -297,7 +428,7 @@ conf = {{{packageName}}}.Configuration( result.debug = self.debug return result - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: Any) -> None: object.__setattr__(self, name, value) {{#hasHttpSignatureMethods}} if name == "signing_info" and value is not None: @@ -307,7 +438,7 @@ conf = {{{packageName}}}.Configuration( {{/hasHttpSignatureMethods}} @classmethod - def set_default(cls, default): + def set_default(cls, default: Optional[Self]) -> None: """Set default instance of configuration. It stores default configuration, which can be @@ -318,7 +449,7 @@ conf = {{{packageName}}}.Configuration( cls._default = default @classmethod - def get_default_copy(cls): + def get_default_copy(cls) -> Self: """Deprecated. Please use `get_default` instead. Deprecated. Please use `get_default` instead. @@ -328,7 +459,7 @@ conf = {{{packageName}}}.Configuration( return cls.get_default() @classmethod - def get_default(cls): + def get_default(cls) -> Self: """Return the default configuration. This method returns newly created, based on default constructor, @@ -338,11 +469,11 @@ conf = {{{packageName}}}.Configuration( :return: The configuration object. """ if cls._default is None: - cls._default = Configuration() + cls._default = cls() return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -354,7 +485,7 @@ conf = {{{packageName}}}.Configuration( return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -373,7 +504,7 @@ conf = {{{packageName}}}.Configuration( logger.addHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -382,7 +513,7 @@ conf = {{{packageName}}}.Configuration( return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -404,7 +535,7 @@ conf = {{{packageName}}}.Configuration( httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -415,7 +546,7 @@ conf = {{{packageName}}}.Configuration( return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -426,7 +557,7 @@ conf = {{{packageName}}}.Configuration( self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier, alias=None): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. @@ -443,7 +574,9 @@ conf = {{{packageName}}}.Configuration( else: return key - def get_basic_auth_token(self): + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. @@ -458,12 +591,12 @@ conf = {{{packageName}}}.Configuration( basic_auth=username + ':' + password ).get('authorization') - def auth_settings(self): + def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - auth = {} + auth: AuthSettings = {} {{#authMethods}} {{#isApiKey}} if '{{name}}' in self.api_key{{#vendorExtensions.x-auth-id-alias}} or '{{.}}' in self.api_key{{/vendorExtensions.x-auth-id-alias}}: @@ -521,7 +654,7 @@ conf = {{{packageName}}}.Configuration( {{/authMethods}} return auth - def to_debug_report(self): + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -533,7 +666,7 @@ conf = {{{packageName}}}.Configuration( "SDK Package Version: {{packageVersion}}".\ format(env=sys.platform, pyversion=sys.version) - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -568,7 +701,12 @@ conf = {{{packageName}}}.Configuration( {{/servers}} ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -608,12 +746,12 @@ conf = {{{packageName}}}.Configuration( return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/generators/python/urllib3/templates/pyproject.mustache b/generators/python/urllib3/templates/pyproject.mustache index 01a9bc32..c9826770 100644 --- a/generators/python/urllib3/templates/pyproject.mustache +++ b/generators/python/urllib3/templates/pyproject.mustache @@ -65,7 +65,7 @@ warn_unused_ignores = true ## Getting these passing should be easy strict_equality = true -strict_concatenate = true +extra_checks = true ## Strongly recommend enabling this one as soon as you can check_untyped_defs = true @@ -86,3 +86,20 @@ disallow_any_generics = true # ### This one can be tricky to get passing if you use a lot of untyped libraries #warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "{{{packageName}}}.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/generators/typescript-axios/templates/SHA256SUM b/generators/typescript-axios/templates/SHA256SUM index 636ad183..8d19cd98 100644 --- a/generators/typescript-axios/templates/SHA256SUM +++ b/generators/typescript-axios/templates/SHA256SUM @@ -1,8 +1,8 @@ e13ee7c0cad9a79bab00e8b2a7942bc5a78f63115ece3dfd71a6472bdb02dd22 ./README.mustache 3a077701e62c4d0942657c78cf0116cbe58436e34d723d81aaed7ed0d56d2ed1 ./api.mustache -00efb349f77aed31bd52a6cea64d3b32d4713bc24399b377883ec28b5b38b24a ./apiInner.mustache +244ce751d42c4d1ab2eadb28dbe6744e4e5a7c934ffde2eae9bf25b77ef12d49 ./apiInner.mustache d8d68213e1a9a9983f89f688aaf31360f69d34a871cab4fc94f59a40279b13d9 ./configuration.mustache 5030fcd1954b4d981f2d06fce4900fe29c97c7b74ee66f2eb5f45e81b9252a94 ./index.mustache -62bbc44c32ed454a215fc76636eaca819f012b65486485fda7499f7937557cc4 ./package.mustache +ddc15a816c127736387e9ad99dfa9e965c587ff80b599b286e0d614e69c602e0 ./package.mustache 89b381b068d1849cc98721643c923ee153a5bdd69e19306dda59114ba0a2e243 ./tsconfig.mustache diff --git a/generators/typescript-axios/templates/apiInner.mustache b/generators/typescript-axios/templates/apiInner.mustache index c8418d85..cf1b9e32 100644 --- a/generators/typescript-axios/templates/apiInner.mustache +++ b/generators/typescript-axios/templates/apiInner.mustache @@ -156,34 +156,6 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{/isArray}} {{/queryParams}} - {{#headerParams}} - {{#isArray}} - if ({{paramName}}) { - {{#uniqueItems}} - let mapped = Array.from({{paramName}}).map(value => ("{{{dataType}}}" !== "Set") ? JSON.stringify(value) : (value || "")); - {{/uniqueItems}} - {{^uniqueItems}} - let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); - {{/uniqueItems}} - localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); - } - {{/isArray}} - {{^isArray}} - {{! `val == null` covers for both `null` and `undefined`}} - if ({{paramName}} != null) { - {{#isString}} - localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); - {{/isString}} - {{^isString}} - {{! isString is falsy also for $ref that defines a string or enum type}} - localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string' - ? {{paramName}} - : JSON.stringify({{paramName}}); - {{/isString}} - } - {{/isArray}} - - {{/headerParams}} {{#vendorExtensions}} {{#formParams}} {{#isArray}} @@ -225,6 +197,33 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{/consumes.0}} {{/bodyParam}} + {{#headerParams}} + {{#isArray}} + if ({{paramName}}) { + {{#uniqueItems}} + let mapped = Array.from({{paramName}}).map(value => ("{{{dataType}}}" !== "Set") ? JSON.stringify(value) : (value || "")); + {{/uniqueItems}} + {{^uniqueItems}} + let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); + {{/uniqueItems}} + localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + } + {{/isArray}} + {{^isArray}} + {{! `val == null` covers for both `null` and `undefined`}} + if ({{paramName}} != null) { + {{#isString}} + localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); + {{/isString}} + {{^isString}} + {{! isString is falsy also for $ref that defines a string or enum type}} + localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string' + ? {{paramName}} + : JSON.stringify({{paramName}}); + {{/isString}} + } + {{/isArray}} + {{/headerParams}} setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers}; @@ -466,4 +465,4 @@ export type {{operationIdCamelCase}}{{enumName}} = typeof {{operationIdCamelCase {{/isEnum}} {{/allParams}} {{/operation}} -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/generators/typescript-axios/templates/package.mustache b/generators/typescript-axios/templates/package.mustache index 711cb54e..b4ded84d 100644 --- a/generators/typescript-axios/templates/package.mustache +++ b/generators/typescript-axios/templates/package.mustache @@ -20,7 +20,7 @@ "api" {{! Added keywords - END }} ], - "license": "MIT", {{! Updated license }} + "license": "{{licenseName}}", "main": "./dist/index.js", "typings": "./dist/index.d.ts", {{#supportsES6}} diff --git a/shell/generate.sh b/shell/generate.sh index 30480c8e..469433d3 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.9.0} +OPENAPI_GENERATOR_VERSION=${OPENAPI_GENERATOR_VERSION:-v7.10.0} OPENAPI_GENERATOR_COMMAND=${OPENAPI_GENERATOR_COMMAND:-\ docker run --rm -v "$(pwd):/local" -w /local \ openapitools/openapi-generator-cli:${OPENAPI_GENERATOR_VERSION}}
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}