forked from loafle/openapi-generator-original
add function to handle missing delimiter in regex
This commit is contained in:
parent
44c8893ed5
commit
a58845bb0f
@ -542,7 +542,7 @@ public class DefaultCodegen {
|
||||
* @return properly-escaped pattern
|
||||
*/
|
||||
public String toRegularExpression(String pattern) {
|
||||
return escapeText(pattern);
|
||||
return escapeText(addRegularExpressionDelimiter(pattern));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3264,4 +3264,19 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the pattern misses the delimiter, add "/" to the beginning and end
|
||||
* Otherwise, return the original pattern
|
||||
*
|
||||
* @param pattern the pattern (regular expression)
|
||||
* @return the pattern with delimiter
|
||||
*/
|
||||
public String addRegularExpressionDelimiter(String pattern) {
|
||||
if (pattern != null && !pattern.matches("^/.*")) {
|
||||
return "/" + pattern + "/";
|
||||
}
|
||||
|
||||
return pattern;
|
||||
}
|
||||
}
|
||||
|
@ -727,4 +727,5 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("=end", "=_end").replace("=begin", "=_begin");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ paths:
|
||||
- name: enum_form_string_array
|
||||
type: array
|
||||
items:
|
||||
tyep: string
|
||||
type: string
|
||||
default: '$'
|
||||
enum:
|
||||
- '>'
|
||||
@ -616,7 +616,7 @@ paths:
|
||||
- name: enum_header_string_array
|
||||
type: array
|
||||
items:
|
||||
tyep: string
|
||||
type: string
|
||||
default: '$'
|
||||
enum:
|
||||
- '>'
|
||||
@ -737,6 +737,11 @@ paths:
|
||||
pattern: /[a-z]/i
|
||||
in: formData
|
||||
description: None
|
||||
- name: pattern_without_delimiter
|
||||
type: string
|
||||
pattern: "^[A-Z].*"
|
||||
in: formData
|
||||
description: None
|
||||
required: true
|
||||
- name: byte
|
||||
type: string
|
||||
|
@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https://
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-08-15T23:29:03.602+01:00
|
||||
- Build date: 2016-08-22T17:54:52.358+08:00
|
||||
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
|
||||
|
||||
## Requirements.
|
||||
@ -130,6 +130,12 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -143,12 +149,6 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -55,7 +55,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **test_endpoint_parameters**
|
||||
> test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password)
|
||||
> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password)
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
@ -76,12 +76,13 @@ petstore_api.configuration.password = 'YOUR_PASSWORD'
|
||||
api_instance = petstore_api.FakeApi()
|
||||
number = 3.4 # float | None
|
||||
double = 1.2 # float | None
|
||||
string = 'string_example' # str | None
|
||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||
byte = 'B' # str | None
|
||||
integer = 56 # int | None (optional)
|
||||
int32 = 56 # int | None (optional)
|
||||
int64 = 789 # int | None (optional)
|
||||
float = 3.4 # float | None (optional)
|
||||
string = 'string_example' # str | None (optional)
|
||||
binary = 'B' # str | None (optional)
|
||||
date = '2013-10-20' # date | None (optional)
|
||||
date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
||||
@ -89,7 +90,7 @@ password = 'password_example' # str | None (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
api_instance.test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password)
|
||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password)
|
||||
except ApiException as e:
|
||||
print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e
|
||||
```
|
||||
@ -100,12 +101,13 @@ Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **float**| None |
|
||||
**double** | **float**| None |
|
||||
**string** | **str**| None |
|
||||
**pattern_without_delimiter** | **str**| None |
|
||||
**byte** | **str**| None |
|
||||
**integer** | **int**| None | [optional]
|
||||
**int32** | **int**| None | [optional]
|
||||
**int64** | **int**| None | [optional]
|
||||
**float** | **float**| None | [optional]
|
||||
**string** | **str**| None | [optional]
|
||||
**binary** | **str**| None | [optional]
|
||||
**date** | **date**| None | [optional]
|
||||
**date_time** | **datetime**| None | [optional]
|
||||
|
@ -155,7 +155,7 @@ class FakeApi(object):
|
||||
callback=params.get('callback'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'))
|
||||
|
||||
def test_endpoint_parameters(self, number, double, string, byte, **kwargs):
|
||||
def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs):
|
||||
"""
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@ -166,18 +166,19 @@ class FakeApi(object):
|
||||
>>> def callback_function(response):
|
||||
>>> pprint(response)
|
||||
>>>
|
||||
>>> thread = api.test_endpoint_parameters(number, double, string, byte, callback=callback_function)
|
||||
>>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, callback=callback_function)
|
||||
|
||||
:param callback function: The callback function
|
||||
for asynchronous request. (optional)
|
||||
:param float number: None (required)
|
||||
:param float double: None (required)
|
||||
:param str string: None (required)
|
||||
:param str pattern_without_delimiter: None (required)
|
||||
:param str byte: None (required)
|
||||
:param int integer: None
|
||||
:param int int32: None
|
||||
:param int int64: None
|
||||
:param float float: None
|
||||
:param str string: None
|
||||
:param str binary: None
|
||||
:param date date: None
|
||||
:param datetime date_time: None
|
||||
@ -188,12 +189,12 @@ class FakeApi(object):
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('callback'):
|
||||
return self.test_endpoint_parameters_with_http_info(number, double, string, byte, **kwargs)
|
||||
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs)
|
||||
else:
|
||||
(data) = self.test_endpoint_parameters_with_http_info(number, double, string, byte, **kwargs)
|
||||
(data) = self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs)
|
||||
return data
|
||||
|
||||
def test_endpoint_parameters_with_http_info(self, number, double, string, byte, **kwargs):
|
||||
def test_endpoint_parameters_with_http_info(self, number, double, pattern_without_delimiter, byte, **kwargs):
|
||||
"""
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@ -204,18 +205,19 @@ class FakeApi(object):
|
||||
>>> def callback_function(response):
|
||||
>>> pprint(response)
|
||||
>>>
|
||||
>>> thread = api.test_endpoint_parameters_with_http_info(number, double, string, byte, callback=callback_function)
|
||||
>>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, callback=callback_function)
|
||||
|
||||
:param callback function: The callback function
|
||||
for asynchronous request. (optional)
|
||||
:param float number: None (required)
|
||||
:param float double: None (required)
|
||||
:param str string: None (required)
|
||||
:param str pattern_without_delimiter: None (required)
|
||||
:param str byte: None (required)
|
||||
:param int integer: None
|
||||
:param int int32: None
|
||||
:param int int64: None
|
||||
:param float float: None
|
||||
:param str string: None
|
||||
:param str binary: None
|
||||
:param date date: None
|
||||
:param datetime date_time: None
|
||||
@ -225,7 +227,7 @@ class FakeApi(object):
|
||||
returns the request thread.
|
||||
"""
|
||||
|
||||
all_params = ['number', 'double', 'string', 'byte', 'integer', 'int32', 'int64', 'float', 'binary', 'date', 'date_time', 'password']
|
||||
all_params = ['number', 'double', 'pattern_without_delimiter', 'byte', 'integer', 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', 'password']
|
||||
all_params.append('callback')
|
||||
all_params.append('_return_http_data_only')
|
||||
|
||||
@ -244,9 +246,9 @@ class FakeApi(object):
|
||||
# verify the required parameter 'double' is set
|
||||
if ('double' not in params) or (params['double'] is None):
|
||||
raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`")
|
||||
# verify the required parameter 'string' is set
|
||||
if ('string' not in params) or (params['string'] is None):
|
||||
raise ValueError("Missing the required parameter `string` when calling `test_endpoint_parameters`")
|
||||
# verify the required parameter 'pattern_without_delimiter' is set
|
||||
if ('pattern_without_delimiter' not in params) or (params['pattern_without_delimiter'] is None):
|
||||
raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`")
|
||||
# verify the required parameter 'byte' is set
|
||||
if ('byte' not in params) or (params['byte'] is None):
|
||||
raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`")
|
||||
@ -259,8 +261,8 @@ class FakeApi(object):
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`")
|
||||
if 'double' in params and params['double'] < 67.8:
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`")
|
||||
if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE):
|
||||
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`")
|
||||
if 'pattern_without_delimiter' in params and not re.search('^[A-Z].*', params['pattern_without_delimiter']):
|
||||
raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`")
|
||||
if 'integer' in params and params['integer'] > 100.0:
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100.0`")
|
||||
if 'integer' in params and params['integer'] < 10.0:
|
||||
@ -271,6 +273,8 @@ class FakeApi(object):
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20.0`")
|
||||
if 'float' in params and params['float'] > 987.6:
|
||||
raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`")
|
||||
if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE):
|
||||
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`")
|
||||
if 'password' in params and len(params['password']) > 64:
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`")
|
||||
if 'password' in params and len(params['password']) < 10:
|
||||
@ -298,6 +302,8 @@ class FakeApi(object):
|
||||
form_params.append(('double', params['double']))
|
||||
if 'string' in params:
|
||||
form_params.append(('string', params['string']))
|
||||
if 'pattern_without_delimiter' in params:
|
||||
form_params.append(('pattern_without_delimiter', params['pattern_without_delimiter']))
|
||||
if 'byte' in params:
|
||||
form_params.append(('byte', params['byte']))
|
||||
if 'binary' in params:
|
||||
|
@ -221,6 +221,13 @@ class Configuration(object):
|
||||
:return: The Auth Settings information dict.
|
||||
"""
|
||||
return {
|
||||
'api_key':
|
||||
{
|
||||
'type': 'api_key',
|
||||
'in': 'header',
|
||||
'key': 'api_key',
|
||||
'value': self.get_api_key_with_prefix('api_key')
|
||||
},
|
||||
|
||||
'petstore_auth':
|
||||
{
|
||||
@ -236,13 +243,6 @@ class Configuration(object):
|
||||
'key': 'Authorization',
|
||||
'value': self.get_basic_auth_token()
|
||||
},
|
||||
'api_key':
|
||||
{
|
||||
'type': 'api_key',
|
||||
'in': 'header',
|
||||
'key': 'api_key',
|
||||
'value': self.get_api_key_with_prefix('api_key')
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-08-09T19:11:03.532+10:00
|
||||
- Build date: 2016-08-22T16:46:39.641+08:00
|
||||
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||
|
||||
## Installation
|
||||
@ -78,7 +78,7 @@ Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
|
||||
*Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*Petstore::FakeApi* | [**test_enum_query_parameters**](docs/FakeApi.md#test_enum_query_parameters) | **GET** /fake | To test enum query parameters
|
||||
*Petstore::FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
|
||||
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
@ -137,6 +137,12 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -146,9 +152,7 @@ Class | Method | HTTP request | Description
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### api_key
|
||||
### http_basic_test
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
|
@ -6,7 +6,7 @@ Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
|
||||
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**test_enum_query_parameters**](FakeApi.md#test_enum_query_parameters) | **GET** /fake | To test enum query parameters
|
||||
[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
|
||||
|
||||
|
||||
# **test_client_model**
|
||||
@ -55,7 +55,7 @@ No authorization required
|
||||
|
||||
|
||||
# **test_endpoint_parameters**
|
||||
> test_endpoint_parameters(number, double, string, byte, opts)
|
||||
> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts)
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
@ -65,6 +65,12 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure HTTP basic authorization: http_basic_test
|
||||
config.username = 'YOUR USERNAME'
|
||||
config.password = 'YOUR PASSWORD'
|
||||
end
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
@ -72,7 +78,7 @@ number = 3.4 # Float | None
|
||||
|
||||
double = 1.2 # Float | None
|
||||
|
||||
string = "string_example" # String | None
|
||||
pattern_without_delimiter = "pattern_without_delimiter_example" # String | None
|
||||
|
||||
byte = "B" # String | None
|
||||
|
||||
@ -81,6 +87,7 @@ opts = {
|
||||
int32: 56, # Integer | None
|
||||
int64: 789, # Integer | None
|
||||
float: 3.4, # Float | None
|
||||
string: "string_example", # String | None
|
||||
binary: "B", # String | None
|
||||
date: Date.parse("2013-10-20"), # Date | None
|
||||
date_time: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | None
|
||||
@ -89,7 +96,7 @@ opts = {
|
||||
|
||||
begin
|
||||
#Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
api_instance.test_endpoint_parameters(number, double, string, byte, opts)
|
||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}"
|
||||
end
|
||||
@ -101,12 +108,13 @@ Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **Float**| None |
|
||||
**double** | **Float**| None |
|
||||
**string** | **String**| None |
|
||||
**pattern_without_delimiter** | **String**| None |
|
||||
**byte** | **String**| None |
|
||||
**integer** | **Integer**| None | [optional]
|
||||
**int32** | **Integer**| None | [optional]
|
||||
**int64** | **Integer**| None | [optional]
|
||||
**float** | **Float**| None | [optional]
|
||||
**string** | **String**| None | [optional]
|
||||
**binary** | **String**| None | [optional]
|
||||
**date** | **Date**| None | [optional]
|
||||
**date_time** | **DateTime**| None | [optional]
|
||||
@ -118,7 +126,7 @@ nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[http_basic_test](../README.md#http_basic_test)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@ -127,10 +135,10 @@ No authorization required
|
||||
|
||||
|
||||
|
||||
# **test_enum_query_parameters**
|
||||
> test_enum_query_parameters(opts)
|
||||
# **test_enum_parameters**
|
||||
> test_enum_parameters(opts)
|
||||
|
||||
To test enum query parameters
|
||||
To test enum parameters
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
@ -140,16 +148,21 @@ require 'petstore'
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
enum_form_string_array: ["enum_form_string_array_example"], # Array<String> | Form parameter enum test (string array)
|
||||
enum_form_string: "-efg", # String | Form parameter enum test (string)
|
||||
enum_header_string_array: ["enum_header_string_array_example"], # Array<String> | Header parameter enum test (string array)
|
||||
enum_header_string: "-efg", # String | Header parameter enum test (string)
|
||||
enum_query_string_array: ["enum_query_string_array_example"], # Array<String> | Query parameter enum test (string array)
|
||||
enum_query_string: "-efg", # String | Query parameter enum test (string)
|
||||
enum_query_integer: 3.4, # Float | Query parameter enum test (double)
|
||||
enum_query_double: 1.2 # Float | Query parameter enum test (double)
|
||||
}
|
||||
|
||||
begin
|
||||
#To test enum query parameters
|
||||
api_instance.test_enum_query_parameters(opts)
|
||||
#To test enum parameters
|
||||
api_instance.test_enum_parameters(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling FakeApi->test_enum_query_parameters: #{e}"
|
||||
puts "Exception when calling FakeApi->test_enum_parameters: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@ -157,6 +170,11 @@ end
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enum_form_string_array** | [**Array<String>**](String.md)| Form parameter enum test (string array) | [optional]
|
||||
**enum_form_string** | **String**| Form parameter enum test (string) | [optional] [default to -efg]
|
||||
**enum_header_string_array** | [**Array<String>**](String.md)| Header parameter enum test (string array) | [optional]
|
||||
**enum_header_string** | **String**| Header parameter enum test (string) | [optional] [default to -efg]
|
||||
**enum_query_string_array** | [**Array<String>**](String.md)| Query parameter enum test (string array) | [optional]
|
||||
**enum_query_string** | **String**| Query parameter enum test (string) | [optional] [default to -efg]
|
||||
**enum_query_integer** | **Float**| Query parameter enum test (double) | [optional]
|
||||
**enum_query_double** | **Float**| Query parameter enum test (double) | [optional]
|
||||
|
@ -92,20 +92,21 @@ module Petstore
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
# @param double None
|
||||
# @param string None
|
||||
# @param pattern_without_delimiter None
|
||||
# @param byte None
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :integer None
|
||||
# @option opts [Integer] :int32 None
|
||||
# @option opts [Integer] :int64 None
|
||||
# @option opts [Float] :float None
|
||||
# @option opts [String] :string None
|
||||
# @option opts [String] :binary None
|
||||
# @option opts [Date] :date None
|
||||
# @option opts [DateTime] :date_time None
|
||||
# @option opts [String] :password None
|
||||
# @return [nil]
|
||||
def test_endpoint_parameters(number, double, string, byte, opts = {})
|
||||
test_endpoint_parameters_with_http_info(number, double, string, byte, opts)
|
||||
def test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts = {})
|
||||
test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
@ -113,19 +114,20 @@ module Petstore
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
# @param double None
|
||||
# @param string None
|
||||
# @param pattern_without_delimiter None
|
||||
# @param byte None
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :integer None
|
||||
# @option opts [Integer] :int32 None
|
||||
# @option opts [Integer] :int64 None
|
||||
# @option opts [Float] :float None
|
||||
# @option opts [String] :string None
|
||||
# @option opts [String] :binary None
|
||||
# @option opts [Date] :date None
|
||||
# @option opts [DateTime] :date_time None
|
||||
# @option opts [String] :password None
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_endpoint_parameters_with_http_info(number, double, string, byte, opts = {})
|
||||
def test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_endpoint_parameters ..."
|
||||
end
|
||||
@ -149,10 +151,10 @@ module Petstore
|
||||
fail ArgumentError, 'invalid value for "double" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 67.8.'
|
||||
end
|
||||
|
||||
# verify the required parameter 'string' is set
|
||||
fail ArgumentError, "Missing the required parameter 'string' when calling FakeApi.test_endpoint_parameters" if string.nil?
|
||||
if string !~ Regexp.new(/[a-z]/i)
|
||||
fail ArgumentError, 'invalid value for "string" when calling FakeApi.test_endpoint_parameters, must conform to the pattern /[a-z]/i.'
|
||||
# verify the required parameter 'pattern_without_delimiter' is set
|
||||
fail ArgumentError, "Missing the required parameter 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters" if pattern_without_delimiter.nil?
|
||||
if pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/)
|
||||
fail ArgumentError, 'invalid value for "pattern_without_delimiter" when calling FakeApi.test_endpoint_parameters, must conform to the pattern /^[A-Z].*/.'
|
||||
end
|
||||
|
||||
# verify the required parameter 'byte' is set
|
||||
@ -177,6 +179,10 @@ module Petstore
|
||||
fail ArgumentError, 'invalid value for "opts[:"float"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 987.6.'
|
||||
end
|
||||
|
||||
if !opts[:'string'].nil? && opts[:'string'] !~ Regexp.new(/[a-z]/i)
|
||||
fail ArgumentError, 'invalid value for "opts[:"string"]" when calling FakeApi.test_endpoint_parameters, must conform to the pattern /[a-z]/i.'
|
||||
end
|
||||
|
||||
if !opts[:'password'].nil? && opts[:'password'].to_s.length > 64
|
||||
fail ArgumentError, 'invalid value for "opts[:"password"]" when calling FakeApi.test_endpoint_parameters, the character length must be smaller than or equal to 64.'
|
||||
end
|
||||
@ -206,12 +212,13 @@ module Petstore
|
||||
form_params = {}
|
||||
form_params["number"] = number
|
||||
form_params["double"] = double
|
||||
form_params["string"] = string
|
||||
form_params["pattern_without_delimiter"] = pattern_without_delimiter
|
||||
form_params["byte"] = byte
|
||||
form_params["integer"] = opts[:'integer'] if !opts[:'integer'].nil?
|
||||
form_params["int32"] = opts[:'int32'] if !opts[:'int32'].nil?
|
||||
form_params["int64"] = opts[:'int64'] if !opts[:'int64'].nil?
|
||||
form_params["float"] = opts[:'float'] if !opts[:'float'].nil?
|
||||
form_params["string"] = opts[:'string'] if !opts[:'string'].nil?
|
||||
form_params["binary"] = opts[:'binary'] if !opts[:'binary'].nil?
|
||||
form_params["date"] = opts[:'date'] if !opts[:'date'].nil?
|
||||
form_params["dateTime"] = opts[:'date_time'] if !opts[:'date_time'].nil?
|
||||
@ -219,7 +226,7 @@ module Petstore
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
auth_names = ['http_basic_test']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@ -232,28 +239,53 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# To test enum query parameters
|
||||
# To test enum parameters
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Array<String>] :enum_form_string_array Form parameter enum test (string array)
|
||||
# @option opts [String] :enum_form_string Form parameter enum test (string) (default to -efg)
|
||||
# @option opts [Array<String>] :enum_header_string_array Header parameter enum test (string array)
|
||||
# @option opts [String] :enum_header_string Header parameter enum test (string) (default to -efg)
|
||||
# @option opts [Array<String>] :enum_query_string_array Query parameter enum test (string array)
|
||||
# @option opts [String] :enum_query_string Query parameter enum test (string) (default to -efg)
|
||||
# @option opts [Float] :enum_query_integer Query parameter enum test (double)
|
||||
# @option opts [Float] :enum_query_double Query parameter enum test (double)
|
||||
# @return [nil]
|
||||
def test_enum_query_parameters(opts = {})
|
||||
test_enum_query_parameters_with_http_info(opts)
|
||||
def test_enum_parameters(opts = {})
|
||||
test_enum_parameters_with_http_info(opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# To test enum query parameters
|
||||
# To test enum parameters
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Array<String>] :enum_form_string_array Form parameter enum test (string array)
|
||||
# @option opts [String] :enum_form_string Form parameter enum test (string)
|
||||
# @option opts [Array<String>] :enum_header_string_array Header parameter enum test (string array)
|
||||
# @option opts [String] :enum_header_string Header parameter enum test (string)
|
||||
# @option opts [Array<String>] :enum_query_string_array Query parameter enum test (string array)
|
||||
# @option opts [String] :enum_query_string Query parameter enum test (string)
|
||||
# @option opts [Float] :enum_query_integer Query parameter enum test (double)
|
||||
# @option opts [Float] :enum_query_double Query parameter enum test (double)
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_enum_query_parameters_with_http_info(opts = {})
|
||||
def test_enum_parameters_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_enum_query_parameters ..."
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_enum_parameters ..."
|
||||
end
|
||||
if opts[:'enum_form_string_array'] && !['>', '$'].include?(opts[:'enum_form_string_array'])
|
||||
fail ArgumentError, 'invalid value for "enum_form_string_array", must be one of >, $'
|
||||
end
|
||||
if opts[:'enum_form_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_form_string'])
|
||||
fail ArgumentError, 'invalid value for "enum_form_string", must be one of _abc, -efg, (xyz)'
|
||||
end
|
||||
if opts[:'enum_header_string_array'] && !['>', '$'].include?(opts[:'enum_header_string_array'])
|
||||
fail ArgumentError, 'invalid value for "enum_header_string_array", must be one of >, $'
|
||||
end
|
||||
if opts[:'enum_header_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_header_string'])
|
||||
fail ArgumentError, 'invalid value for "enum_header_string", must be one of _abc, -efg, (xyz)'
|
||||
end
|
||||
if opts[:'enum_query_string_array'] && !['>', '$'].include?(opts[:'enum_query_string_array'])
|
||||
fail ArgumentError, 'invalid value for "enum_query_string_array", must be one of >, $'
|
||||
end
|
||||
if opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string'])
|
||||
fail ArgumentError, 'invalid value for "enum_query_string", must be one of _abc, -efg, (xyz)'
|
||||
@ -263,6 +295,8 @@ module Petstore
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :csv) if !opts[:'enum_query_string_array'].nil?
|
||||
query_params[:'enum_query_string'] = opts[:'enum_query_string'] if !opts[:'enum_query_string'].nil?
|
||||
query_params[:'enum_query_integer'] = opts[:'enum_query_integer'] if !opts[:'enum_query_integer'].nil?
|
||||
|
||||
# header parameters
|
||||
@ -275,10 +309,13 @@ module Petstore
|
||||
# HTTP header 'Content-Type'
|
||||
local_header_content_type = ['application/json']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
||||
header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil?
|
||||
header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil?
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["enum_query_string"] = opts[:'enum_query_string'] if !opts[:'enum_query_string'].nil?
|
||||
form_params["enum_form_string_array"] = @api_client.build_collection_param(opts[:'enum_form_string_array'], :csv) if !opts[:'enum_form_string_array'].nil?
|
||||
form_params["enum_form_string"] = opts[:'enum_form_string'] if !opts[:'enum_form_string'].nil?
|
||||
form_params["enum_query_double"] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil?
|
||||
|
||||
# http body (model)
|
||||
@ -291,7 +328,7 @@ module Petstore
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_enum_query_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_enum_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
@ -201,13 +201,6 @@ module Petstore
|
||||
# Returns Auth Settings hash for api client.
|
||||
def auth_settings
|
||||
{
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
'api_key' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
@ -215,6 +208,20 @@ module Petstore
|
||||
key: 'api_key',
|
||||
value: api_key_with_prefix('api_key')
|
||||
},
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
'http_basic_test' =>
|
||||
{
|
||||
type: 'basic',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: basic_auth_token
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user