From 8c64fd033e5a1278b8b114d1d713bde79ba470db Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Fri, 2 Aug 2019 15:12:24 +0800
Subject: [PATCH 1/4] use partial for ruby http libraries

---
 .../ruby-client/configuration.mustache        | 52 ++++++-------------
 ...configuration_tls_faraday_partial.mustache | 30 +++++++++++
 ...onfiguration_tls_typhoeus_partial.mustache | 34 ++++++++++++
 .../ruby-faraday/lib/petstore/api_client.rb   | 20 +++----
 .../lib/petstore/configuration.rb             | 37 ++++++-------
 .../petstore/ruby-faraday/petstore.gemspec    |  6 ++-
 .../ruby-faraday/spec/api_client_spec.rb      | 38 ++++++++++++++
 7 files changed, 154 insertions(+), 63 deletions(-)
 create mode 100644 modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache
 create mode 100644 modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache

diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache
index 3c0148fbd4d..955af0f55d0 100644
--- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache
@@ -66,46 +66,19 @@ module {{moduleName}}
     # Default to 0 (never times out).
     attr_accessor :timeout
 
+    {{^isFaraday}}
     # Set this to false to skip client side validation in the operation.
     # Default to true.
     # @return [true, false]
     attr_accessor :client_side_validation
 
-    ### TLS/SSL setting
-    # Set this to false to skip verifying SSL certificate when calling API from https server.
-    # Default to true.
-    #
-    # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
-    #
-    # @return [true, false]
-    attr_accessor :verify_ssl
-
-    ### TLS/SSL setting
-    # Set this to false to skip verifying SSL host name
-    # Default to true.
-    #
-    # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
-    #
-    # @return [true, false]
-    attr_accessor :verify_ssl_host
-
-    ### TLS/SSL setting
-    # Set this to customize the certificate file to verify the peer.
-    #
-    # @return [String] the path to the certificate file
-    #
-    # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
-    # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
-    attr_accessor :ssl_ca_cert
-
-    ### TLS/SSL setting
-    # Client certificate file (for client certificate)
-    attr_accessor :cert_file
-
-    ### TLS/SSL setting
-    # Client private key file (for client certificate)
-    attr_accessor :key_file
-
+    {{/isFaraday}}
+{{^isFaraday}}
+{{> configuration_tls_typhoeus_partial}}
+{{/isFaraday}}
+{{#isFaraday}}
+{{> configuration_tls_faraday_partial}}
+{{/isFaraday}}
     # Set this to customize parameters encoding of array parameter with multi collectionFormat.
     # Default to nil.
     #
@@ -125,11 +98,20 @@ module {{moduleName}}
       @api_key_prefix = {}
       @timeout = 0
       @client_side_validation = true
+      {{#isFaraday}}
+      @ssl_verify = true
+      @ssl_verify_mode = nil
+      @ssl_ca_file = nil
+      @ssl_client_cert = nil
+      @ssl_client_key = nil
+      {{/isFaraday}}
+      {{^isFaraday}}
       @verify_ssl = true
       @verify_ssl_host = true
       @params_encoding = nil
       @cert_file = nil
       @key_file = nil
+      {{/isFaraday}}
       @debugging = false
       @inject_format = false
       @force_ending_format = false
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
new file mode 100644
index 00000000000..a32b2b89bd6
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_faraday_partial.mustache
@@ -0,0 +1,30 @@
+    ### TLS/SSL setting
+    # Set this to false to skip verifying SSL certificate when calling API from https server.
+    # Default to true.
+    #
+    # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+    #
+    # @return [true, false]
+    attr_accessor :ssl_verify
+
+    ### TLS/SSL setting
+    # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
+    #
+    # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+    #
+    attr_accessor :ssl_verify_mode
+
+    ### TLS/SSL setting
+    # Set this to customize the certificate file to verify the peer.
+    #
+    # @return [String] the path to the certificate file
+    attr_accessor :ssl_ca_file
+
+    ### TLS/SSL setting
+    # Client certificate file (for client certificate)
+    attr_accessor :ssl_client_cert
+
+    ### TLS/SSL setting
+    # Client private key file (for client certificate)
+    attr_accessor :ssl_client_key
+
diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache
new file mode 100644
index 00000000000..b75954c254a
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration_tls_typhoeus_partial.mustache
@@ -0,0 +1,34 @@
+    ### TLS/SSL setting
+    # Set this to false to skip verifying SSL certificate when calling API from https server.
+    # Default to true.
+    #
+    # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+    #
+    # @return [true, false]
+    attr_accessor :verify_ssl
+
+    ### TLS/SSL setting
+    # Set this to false to skip verifying SSL host name
+    # Default to true.
+    #
+    # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+    #
+    # @return [true, false]
+    attr_accessor :verify_ssl_host
+
+    ### TLS/SSL setting
+    # Set this to customize the certificate file to verify the peer.
+    #
+    # @return [String] the path to the certificate file
+    #
+    # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
+    # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
+    attr_accessor :ssl_ca_cert
+
+    ### TLS/SSL setting
+    # Client certificate file (for client certificate)
+    attr_accessor :cert_file
+
+    ### TLS/SSL setting
+    # Client private key file (for client certificate)
+    attr_accessor :key_file
diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb
index f5167c18671..a09fb09f0ed 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb
@@ -46,7 +46,15 @@ module Petstore
     # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
     #   the data deserialized from response body (could be nil), response status code and response headers.
     def call_api(http_method, path, opts = {})
-      connection = Faraday.new(:url => config.base_url) do |conn|
+      ssl_options = {
+        :ca_file => @config.ssl_ca_file,
+        :verify => @config.ssl_verify,
+        :verify => @config.ssl_verify_mode,
+        :client_cert => @config.ssl_client_cert,
+        :client_key => @config.ssl_client_key
+      }
+
+      connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
         conn.basic_auth(config.username, config.password)
         if opts[:header_params]["Content-Type"] == "multipart/form-data"
           conn.request :multipart
@@ -54,6 +62,7 @@ module Petstore
         end
         conn.adapter(Faraday.default_adapter)
       end
+
       begin
         response = connection.public_send(http_method.to_sym.downcase) do |req|
           build_request(http_method, path, req, opts)
@@ -106,8 +115,7 @@ module Petstore
 
       update_params_for_auth! header_params, query_params, opts[:auth_names]
 
-      # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
-      _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
+
 
       req_opts = {
         :method => http_method,
@@ -115,15 +123,9 @@ module Petstore
         :params => query_params,
         :params_encoding => @config.params_encoding,
         :timeout => @config.timeout,
-        :ssl_verifypeer => @config.verify_ssl,
-        :ssl_verifyhost => _verify_ssl_host,
-        :sslcert => @config.cert_file,
-        :sslkey => @config.key_file,
         :verbose => @config.debugging
       }
 
-      # set custom cert, if provided
-      req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
 
       if [:post, :patch, :put, :delete].include?(http_method)
         req_body = build_request_body(header_params, form_params, opts[:body])
diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
index 73a5712c90d..1066ceef2f8 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
@@ -79,6 +79,11 @@ module Petstore
     # @return [true, false]
     attr_accessor :client_side_validation
 
+    # Set this to false to skip client side validation in the operation.
+    # Default to true.
+    # @return [true, false]
+    attr_accessor :client_side_validation
+
     ### TLS/SSL setting
     # Set this to false to skip verifying SSL certificate when calling API from https server.
     # Default to true.
@@ -86,33 +91,28 @@ module Petstore
     # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
     #
     # @return [true, false]
-    attr_accessor :verify_ssl
+    attr_accessor :ssl_verify
 
     ### TLS/SSL setting
-    # Set this to false to skip verifying SSL host name
-    # Default to true.
+    # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
     #
     # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
     #
-    # @return [true, false]
-    attr_accessor :verify_ssl_host
+    attr_accessor :ssl_verify_mode
 
     ### TLS/SSL setting
     # Set this to customize the certificate file to verify the peer.
     #
     # @return [String] the path to the certificate file
-    #
-    # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
-    # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
-    attr_accessor :ssl_ca_cert
+    attr_accessor :ssl_ca_file
 
     ### TLS/SSL setting
     # Client certificate file (for client certificate)
-    attr_accessor :cert_file
+    attr_accessor :ssl_client_cert
 
     ### TLS/SSL setting
     # Client private key file (for client certificate)
-    attr_accessor :key_file
+    attr_accessor :ssl_client_key
 
     # Set this to customize parameters encoding of array parameter with multi collectionFormat.
     # Default to nil.
@@ -127,17 +127,18 @@ module Petstore
 
     def initialize
       @scheme = 'http'
-      @host = 'petstore.swagger.io'
-      @base_path = '/v2'
+      @host = 'localhost'
+      @base_path = ''
       @api_key = {}
       @api_key_prefix = {}
+      @params_encoding = nil
       @timeout = 0
       @client_side_validation = true
-      @verify_ssl = true
-      @verify_ssl_host = true
-      @params_encoding = nil
-      @cert_file = nil
-      @key_file = nil
+      @ssl_verify = true
+      @ssl_verify_mode = nil
+      @ssl_ca_file = nil
+      @ssl_client_cert = nil
+      @ssl_client_key = nil
       @debugging = false
       @inject_format = false
       @force_ending_format = false
diff --git a/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec b/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec
index 6cbf88ba127..167ff9a753e 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec
+++ b/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec
@@ -27,12 +27,16 @@ Gem::Specification.new do |s|
   s.license     = "Unlicense"
   s.required_ruby_version = ">= 1.9"
 
-  s.add_runtime_dependency 'faraday', '>= 0.14.0'
+  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
   s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
 
   s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
   s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
   s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
+  s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
+  s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
+  s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
+  s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
 
   s.files         = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
   s.test_files    = `find spec/*`.split("\n")
diff --git a/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb b/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb
index a9fd5b4ba1e..274d78c14cc 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb
@@ -51,6 +51,44 @@ describe Petstore::ApiClient do
     end
   end
 
+  describe 'params_encoding in #build_request' do
+    let(:config) { Petstore::Configuration.new }
+    let(:api_client) { Petstore::ApiClient.new(config) }
+
+    it 'defaults to nil' do
+      expect(Petstore::Configuration.default.params_encoding).to eq(nil)
+      expect(config.params_encoding).to eq(nil)
+
+      request = api_client.build_request(:get, '/test')
+      expect(request.options[:params_encoding]).to eq(nil)
+    end
+
+    it 'can be customized' do
+      config.params_encoding = :multi
+      request = api_client.build_request(:get, '/test')
+      expect(request.options[:params_encoding]).to eq(:multi)
+    end
+  end
+
+  describe 'timeout in #build_request' do
+    let(:config) { Petstore::Configuration.new }
+    let(:api_client) { Petstore::ApiClient.new(config) }
+
+    it 'defaults to 0' do
+      expect(Petstore::Configuration.default.timeout).to eq(0)
+      expect(config.timeout).to eq(0)
+
+      request = api_client.build_request(:get, '/test')
+      expect(request.options[:timeout]).to eq(0)
+    end
+
+    it 'can be customized' do
+      config.timeout = 100
+      request = api_client.build_request(:get, '/test')
+      expect(request.options[:timeout]).to eq(100)
+    end
+  end
+
   describe '#deserialize' do
     it "handles Array<Integer>" do
       api_client = Petstore::ApiClient.new
-- 
GitLab


From dc41141e06cd7eb40cf246152fb50673cb43124a Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Fri, 2 Aug 2019 17:57:46 +0800
Subject: [PATCH 2/4] fix isFaraday

---
 .../codegen/languages/RubyClientCodegen.java  |  4 +-
 .../lib/petstore/configuration.rb             | 16 ++------
 .../petstore/ruby-faraday/petstore.gemspec    |  2 +-
 .../ruby-faraday/spec/api_client_spec.rb      | 38 -------------------
 4 files changed, 6 insertions(+), 54 deletions(-)

diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java
index 2f2af730e38..0b1b59b98df 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java
@@ -233,14 +233,14 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
         supportingFiles.add(new SupportingFile("rubocop.mustache", "", ".rubocop.yml"));
         supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
         supportingFiles.add(new SupportingFile("gemspec.mustache", "", gemName + ".gemspec"));
+        supportingFiles.add(new SupportingFile("configuration.mustache", gemFolder, "configuration.rb"));
 
         if (TYPHOEUS.equals(getLibrary())) {
             supportingFiles.add(new SupportingFile("api_client.mustache", gemFolder, "api_client.rb"));
-            supportingFiles.add(new SupportingFile("configuration.mustache", gemFolder, "configuration.rb"));
             supportingFiles.add(new SupportingFile("Gemfile.lock.mustache", "", "Gemfile.lock"));
         } else if (FARADAY.equals(getLibrary())) {
             supportingFiles.add(new SupportingFile("faraday_api_client.mustache", gemFolder, "api_client.rb"));
-            supportingFiles.add(new SupportingFile("faraday_configuration.mustache", gemFolder, "configuration.rb"));
+            additionalProperties.put("isFaraday", Boolean.TRUE);
         } else {
             throw new RuntimeException("Invalid HTTP library " +  getLibrary() + ". Only faraday, typhoeus are supported.");
         }
diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
index 1066ceef2f8..357866d5a38 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
@@ -74,16 +74,6 @@ module Petstore
     # Default to 0 (never times out).
     attr_accessor :timeout
 
-    # Set this to false to skip client side validation in the operation.
-    # Default to true.
-    # @return [true, false]
-    attr_accessor :client_side_validation
-
-    # Set this to false to skip client side validation in the operation.
-    # Default to true.
-    # @return [true, false]
-    attr_accessor :client_side_validation
-
     ### TLS/SSL setting
     # Set this to false to skip verifying SSL certificate when calling API from https server.
     # Default to true.
@@ -114,6 +104,7 @@ module Petstore
     # Client private key file (for client certificate)
     attr_accessor :ssl_client_key
 
+
     # Set this to customize parameters encoding of array parameter with multi collectionFormat.
     # Default to nil.
     #
@@ -127,11 +118,10 @@ module Petstore
 
     def initialize
       @scheme = 'http'
-      @host = 'localhost'
-      @base_path = ''
+      @host = 'petstore.swagger.io'
+      @base_path = '/v2'
       @api_key = {}
       @api_key_prefix = {}
-      @params_encoding = nil
       @timeout = 0
       @client_side_validation = true
       @ssl_verify = true
diff --git a/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec b/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec
index 167ff9a753e..c414c1806b0 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec
+++ b/samples/openapi3/client/petstore/ruby-faraday/petstore.gemspec
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
   s.license     = "Unlicense"
   s.required_ruby_version = ">= 1.9"
 
-  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
+  s.add_runtime_dependency 'faraday', '>= 0.14.0'
   s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
 
   s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
diff --git a/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb b/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb
index 274d78c14cc..a9fd5b4ba1e 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb
@@ -51,44 +51,6 @@ describe Petstore::ApiClient do
     end
   end
 
-  describe 'params_encoding in #build_request' do
-    let(:config) { Petstore::Configuration.new }
-    let(:api_client) { Petstore::ApiClient.new(config) }
-
-    it 'defaults to nil' do
-      expect(Petstore::Configuration.default.params_encoding).to eq(nil)
-      expect(config.params_encoding).to eq(nil)
-
-      request = api_client.build_request(:get, '/test')
-      expect(request.options[:params_encoding]).to eq(nil)
-    end
-
-    it 'can be customized' do
-      config.params_encoding = :multi
-      request = api_client.build_request(:get, '/test')
-      expect(request.options[:params_encoding]).to eq(:multi)
-    end
-  end
-
-  describe 'timeout in #build_request' do
-    let(:config) { Petstore::Configuration.new }
-    let(:api_client) { Petstore::ApiClient.new(config) }
-
-    it 'defaults to 0' do
-      expect(Petstore::Configuration.default.timeout).to eq(0)
-      expect(config.timeout).to eq(0)
-
-      request = api_client.build_request(:get, '/test')
-      expect(request.options[:timeout]).to eq(0)
-    end
-
-    it 'can be customized' do
-      config.timeout = 100
-      request = api_client.build_request(:get, '/test')
-      expect(request.options[:timeout]).to eq(100)
-    end
-  end
-
   describe '#deserialize' do
     it "handles Array<Integer>" do
       api_client = Petstore::ApiClient.new
-- 
GitLab


From c9d1e6e50794ea18449ad86beb78940f1a210406 Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Fri, 2 Aug 2019 18:01:39 +0800
Subject: [PATCH 3/4] add back client side validation switch

---
 .../src/main/resources/ruby-client/configuration.mustache    | 2 --
 .../petstore/ruby-faraday/lib/petstore/configuration.rb      | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache
index 955af0f55d0..72f6fe90e28 100644
--- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache
@@ -66,13 +66,11 @@ module {{moduleName}}
     # Default to 0 (never times out).
     attr_accessor :timeout
 
-    {{^isFaraday}}
     # Set this to false to skip client side validation in the operation.
     # Default to true.
     # @return [true, false]
     attr_accessor :client_side_validation
 
-    {{/isFaraday}}
 {{^isFaraday}}
 {{> configuration_tls_typhoeus_partial}}
 {{/isFaraday}}
diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
index 357866d5a38..129484edc3f 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
@@ -74,6 +74,11 @@ module Petstore
     # Default to 0 (never times out).
     attr_accessor :timeout
 
+    # Set this to false to skip client side validation in the operation.
+    # Default to true.
+    # @return [true, false]
+    attr_accessor :client_side_validation
+
     ### TLS/SSL setting
     # Set this to false to skip verifying SSL certificate when calling API from https server.
     # Default to true.
-- 
GitLab


From e3b35592585ed86ab6e45f89e8bb58df6823741c Mon Sep 17 00:00:00 2001
From: William Cheng <wing328hk@gmail.com>
Date: Fri, 2 Aug 2019 18:15:34 +0800
Subject: [PATCH 4/4] remove blank lines

---
 .../ruby-client/configuration_tls_faraday_partial.mustache     | 1 -
 .../src/main/resources/ruby-client/faraday_api_client.mustache | 3 ---
 .../client/petstore/ruby-faraday/lib/petstore/api_client.rb    | 3 ---
 .../client/petstore/ruby-faraday/lib/petstore/configuration.rb | 1 -
 4 files changed, 8 deletions(-)

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 a32b2b89bd6..e5f4085cda2 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,4 +27,3 @@
     ### TLS/SSL setting
     # Client private key file (for client certificate)
     attr_accessor :ssl_client_key
-
diff --git a/modules/openapi-generator/src/main/resources/ruby-client/faraday_api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/faraday_api_client.mustache
index f628ffecf07..14509b18a00 100644
--- a/modules/openapi-generator/src/main/resources/ruby-client/faraday_api_client.mustache
+++ b/modules/openapi-generator/src/main/resources/ruby-client/faraday_api_client.mustache
@@ -107,8 +107,6 @@ module {{moduleName}}
 
       update_params_for_auth! header_params, query_params, opts[:auth_names]
 
-
-
       req_opts = {
         :method => http_method,
         :headers => header_params,
@@ -118,7 +116,6 @@ module {{moduleName}}
         :verbose => @config.debugging
       }
 
-
       if [:post, :patch, :put, :delete].include?(http_method)
         req_body = build_request_body(header_params, form_params, opts[:body])
         req_opts.update :body => req_body
diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb
index a09fb09f0ed..dba9af066bb 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api_client.rb
@@ -115,8 +115,6 @@ module Petstore
 
       update_params_for_auth! header_params, query_params, opts[:auth_names]
 
-
-
       req_opts = {
         :method => http_method,
         :headers => header_params,
@@ -126,7 +124,6 @@ module Petstore
         :verbose => @config.debugging
       }
 
-
       if [:post, :patch, :put, :delete].include?(http_method)
         req_body = build_request_body(header_params, form_params, opts[:body])
         req_opts.update :body => req_body
diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
index 129484edc3f..02264ad9516 100644
--- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
+++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/configuration.rb
@@ -109,7 +109,6 @@ module Petstore
     # Client private key file (for client certificate)
     attr_accessor :ssl_client_key
 
-
     # Set this to customize parameters encoding of array parameter with multi collectionFormat.
     # Default to nil.
     #
-- 
GitLab