From 7f8fd4673d95a71bf2f34abd2411c9b450a22e89 Mon Sep 17 00:00:00 2001 From: Zane Wolfgang Pickett Date: Tue, 22 Feb 2022 14:04:32 -0500 Subject: [PATCH 1/2] Expose proxy settings for Ruby Faraday --- .../api_client_faraday_partial.mustache | 16 ++++++++-------- .../configuration_tls_faraday_partial.mustache | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache index a32b6ab6a8a2..4eed519e144a 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache @@ -12,6 +12,7 @@ } connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn| + conn.proxy = config.proxy if config.proxy conn.request(:basic_auth, config.username, config.password) @config.configure_middleware(conn) if opts[:header_params]["Content-Type"] == "multipart/form-data" @@ -62,7 +63,7 @@ # @option opts [Hash] :query_params Query parameters # @option opts [Hash] :form_params Query parameters # @option opts [Object] :body HTTP body (JSON/XML) - # @return [Typhoeus::Request] A Typhoeus Request + # @return [Faraday::Request] A Faraday Request def build_request(http_method, path, request, opts = {}) url = build_request_url(path, opts) http_method = http_method.to_sym.downcase @@ -73,12 +74,6 @@ update_params_for_auth! header_params, query_params, opts[:auth_names] - req_opts = { - :params_encoding => @config.params_encoding, - :timeout => @config.timeout, - :verbose => @config.debugging - } - if [:post, :patch, :put, :delete].include?(http_method) req_body = build_request_body(header_params, form_params, opts[:body]) if @config.debugging @@ -87,7 +82,12 @@ end request.headers = header_params request.body = req_body - request.options = OpenStruct.new(req_opts) + + # Overload default options only if provided + request.options.params_encoding = @config.params_encoding if @config.params_encoding + request.options.timeout = @config.timeout if @config.timeout + request.options.verbose = @config.debugging if @config.debugging + request.url url request.params = query_params download_file(request) if opts[:return_type] == 'File' diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache index e5f4085cda24..598186a7f930 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache @@ -27,3 +27,7 @@ ### TLS/SSL setting # Client private key file (for client certificate) attr_accessor :ssl_client_key + + ### Proxy setting + # HTTP Proxy settings + attr_accessor :proxy From 3dbb0272cea1c138c297d20f1e5261964c71eb2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Jan 2023 08:13:36 +0000 Subject: [PATCH 2/2] Bump json5 in /samples/client/petstore/javascript-flowtyped Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- .../javascript-flowtyped/package-lock.json | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/samples/client/petstore/javascript-flowtyped/package-lock.json b/samples/client/petstore/javascript-flowtyped/package-lock.json index 0384e828482e..a8d528aff0da 100644 --- a/samples/client/petstore/javascript-flowtyped/package-lock.json +++ b/samples/client/petstore/javascript-flowtyped/package-lock.json @@ -3118,13 +3118,10 @@ "peer": true }, "node_modules/json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "dependencies": { - "minimist": "^1.2.5" - }, "bin": { "json5": "lib/cli.js" }, @@ -3172,9 +3169,9 @@ } }, "node_modules/loader-utils/node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { "minimist": "^1.2.0" @@ -6700,13 +6697,10 @@ "peer": true }, "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true }, "jsonfile": { "version": "4.0.0", @@ -6742,9 +6736,9 @@ }, "dependencies": { "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "requires": { "minimist": "^1.2.0"