forked from loafle/openapi-generator-original
fix defeault rspec test for ruby, update security petstore
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -31,24 +31,24 @@ module Petstore
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# To test code injection */ ' \"
|
||||
# To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :test_code_inject____end To test code injection */ ' \"
|
||||
# @option opts [String] :test_code_inject____end____rn_n_r To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
||||
# @return [nil]
|
||||
def test_code_inject____end(opts = {})
|
||||
test_code_inject____end_with_http_info(opts)
|
||||
def test_code_inject____end__rn_n_r(opts = {})
|
||||
test_code_inject____end__rn_n_r_with_http_info(opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# To test code injection */ ' \"
|
||||
# To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :test_code_inject____end To test code injection */ ' \"
|
||||
# @option opts [String] :test_code_inject____end____rn_n_r To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_code_inject____end_with_http_info(opts = {})
|
||||
def test_code_inject____end__rn_n_r_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_code_inject____end ..."
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_code_inject____end__rn_n_r ..."
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake".sub('{format}','json')
|
||||
@@ -60,16 +60,16 @@ module Petstore
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
local_header_accept = ['application/json', '*/ " =end']
|
||||
local_header_accept = ['application/json', '*/ \" =_end -- ']
|
||||
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
local_header_content_type = ['application/json', '*/ " =end']
|
||||
local_header_content_type = ['application/json', '*/ \" =_end -- ']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["test code inject */ ' " =end"] = opts[:'test_code_inject____end'] if !opts[:'test_code_inject____end'].nil?
|
||||
form_params["test code inject */ ' " =end -- \r\n \n \r"] = opts[:'test_code_inject____end____rn_n_r'] if !opts[:'test_code_inject____end____rn_n_r'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
@@ -81,7 +81,7 @@ module Petstore
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_code_inject____end\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_code_inject____end__rn_n_r\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -99,6 +99,9 @@ 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,
|
||||
:headers => header_params,
|
||||
@@ -106,11 +109,13 @@ module Petstore
|
||||
: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)
|
||||
@@ -216,7 +221,7 @@ module Petstore
|
||||
# @return [Tempfile] the file downloaded
|
||||
def download_file(response)
|
||||
content_disposition = response.headers['Content-Disposition']
|
||||
if content_disposition
|
||||
if content_disposition and content_disposition =~ /filename=/i
|
||||
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
||||
prefix = sanitize_filename(filename)
|
||||
else
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -87,7 +87,7 @@ module Petstore
|
||||
# Default to 0 (never times out).
|
||||
attr_accessor :timeout
|
||||
|
||||
### TLS/SSL
|
||||
### TLS/SSL setting
|
||||
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
||||
# Default to true.
|
||||
#
|
||||
@@ -96,13 +96,16 @@ module Petstore
|
||||
# @return [true, false]
|
||||
attr_accessor :verify_ssl
|
||||
|
||||
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
||||
# Default to nil.
|
||||
### TLS/SSL setting
|
||||
# Set this to false to skip verifying SSL host name
|
||||
# Default to true.
|
||||
#
|
||||
# @see The params_encoding option of Ethon. Related source code:
|
||||
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
||||
attr_accessor :params_encoding
|
||||
# @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
|
||||
@@ -111,24 +114,34 @@ module Petstore
|
||||
# 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
|
||||
|
||||
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
||||
# Default to nil.
|
||||
#
|
||||
# @see The params_encoding option of Ethon. Related source code:
|
||||
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
||||
attr_accessor :params_encoding
|
||||
|
||||
attr_accessor :inject_format
|
||||
|
||||
attr_accessor :force_ending_format
|
||||
|
||||
def initialize
|
||||
@scheme = 'https'
|
||||
@host = 'petstore.swagger.io */ ' " =end'
|
||||
@base_path = '/v2 */ ' " =end'
|
||||
@host = 'petstore.swagger.io */ ' " =end -- \r\n \n \r'
|
||||
@base_path = '/v2 */ ' \" =_end -- \\r\\n \\n \\r'
|
||||
@api_key = {}
|
||||
@api_key_prefix = {}
|
||||
@timeout = 0
|
||||
@verify_ssl = true
|
||||
@verify_ssl_host = true
|
||||
@params_encoding = nil
|
||||
@cert_file = nil
|
||||
@key_file = nil
|
||||
@@ -192,8 +205,8 @@ module Petstore
|
||||
{
|
||||
type: 'api_key',
|
||||
in: 'header',
|
||||
key: 'api_key */ ' " =end',
|
||||
value: api_key_with_prefix('api_key */ ' " =end')
|
||||
key: 'api_key */ ' " =end -- \r\n \n \r',
|
||||
value: api_key_with_prefix('api_key */ ' " =end -- \r\n \n \r')
|
||||
},
|
||||
'petstore_auth' =>
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -24,9 +24,9 @@ limitations under the License.
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
# Model for testing reserved words */ ' \"
|
||||
# Model for testing reserved words */ ' \" =_end -- \\r\\n \\n \\r
|
||||
class ModelReturn
|
||||
# property description */ ' \"
|
||||
# property description */ ' \" =_end -- \\r\\n \\n \\r
|
||||
attr_accessor :_return
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=begin
|
||||
#Swagger Petstore */ ' \"
|
||||
#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \"
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \"
|
||||
Contact: apiteam@swagger.io */ ' \"
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
Reference in New Issue
Block a user