Remove x-codegen-hasMore extensions (#169)

* remove x-codegen-hasMoreRequired from ruby template

* remove x-codegen-hasMore from html2 templates

* remove commented code
This commit is contained in:
William Cheng 2018-04-21 12:49:27 +08:00 committed by GitHub
parent d74d2ba031
commit 0736939c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 537 additions and 457 deletions

View File

@ -258,38 +258,6 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
//writeOptional(outputFolder, new SupportingFile("base_object_spec.mustache", specFolder, "base_object_spec.rb"));
}
/* TO BE DELETED: replaced with postProcessOperations below
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Schema> schemas, OpenAPI openAPI) {
CodegenOperation op = super.fromOperation(path, httpMethod, operation, schemas, openAPI);
// Set vendor-extension to be used in template:
// x-codegen-hasMoreRequired
// x-codegen-hasMoreOptional
// x-codegen-hasRequiredParams
CodegenParameter lastRequired = null;
CodegenParameter lastOptional = null;
for (CodegenParameter p : op.allParams) {
if (p.required) {
lastRequired = p;
} else {
lastOptional = p;
}
}
for (CodegenParameter p : op.allParams) {
if (p == lastRequired) {
p.vendorExtensions.put("x-codegen-hasMoreRequired", false);
} else if (p == lastOptional) {
p.vendorExtensions.put("x-codegen-hasMoreOptional", false);
} else {
p.vendorExtensions.put("x-codegen-hasMoreRequired", true);
p.vendorExtensions.put("x-codegen-hasMoreOptional", true);
}
}
op.vendorExtensions.put("x-codegen-hasRequiredParams", lastRequired != null);
return op;
}
*/
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;

View File

@ -168,32 +168,6 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
//path is an unescaped variable in the mustache template api.mustache line 82 '<&path>'
op.path = sanitizePath(op.path);
// Set vendor-extension to be used in template:
// x-codegen-hasMoreRequired
// x-codegen-hasMoreOptional
// x-codegen-hasRequiredParams
CodegenParameter lastRequired = null;
CodegenParameter lastOptional = null;
for (CodegenParameter p : op.allParams) {
if (p.required) {
lastRequired = p;
} else {
lastOptional = p;
}
}
for (CodegenParameter p : op.allParams) {
if (p == lastRequired) {
p.vendorExtensions.put("x-codegen-hasMoreRequired", false);
} else if (p == lastOptional) {
p.vendorExtensions.put("x-codegen-hasMoreOptional", false);
} else {
p.vendorExtensions.put("x-codegen-hasMoreRequired", true);
p.vendorExtensions.put("x-codegen-hasMoreOptional", true);
}
}
op.vendorExtensions.put("x-codegen-hasRequiredParams", lastRequired != null);
op.vendorExtensions.put("x-codegen-httpMethodUpperCase", httpMethod.toUpperCase());
return op;

View File

@ -18,14 +18,21 @@ var {{{name}}} = defaultClient.authentications['{{{name}}}'];
{{/hasAuthMethods}}
var api = new {{{jsModuleName}}}.{{{classname}}}(){{#hasParams}}
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
{{#hasRequiredParams}}
{{#requiredParams}}
var {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{unescapedDescription}}}
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
var opts = { {{#allParams}}{{^required}}
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{unescapedDescription}}}{{/required}}{{/allParams}}
};{{/hasOptionalParams}}{{/hasParams}}
{{/requiredParams}}
{{/hasRequiredParams}}
{{#hasOptionalParams}}
var opts = {
{{#optionalParams}}
'{{{paramName}}}': {{{example}}}{{#hasMore}},{{/hasMore}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{unescapedDescription}}}
{{/optionalParams}}
};
{{/hasOptionalParams}}
{{/hasParams}}
{{#usePromises}}
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
api.{{{operationId}}}({{#requiredParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasOptionalParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
}, function(error) {
console.error(error);
@ -39,5 +46,5 @@ var callback = function(error, data, response) {
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
}
};
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback);
api.{{{operationId}}}({{#requiredParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasOptionalParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback);
{{/usePromises}}

View File

@ -92,7 +92,7 @@ opts = {
begin
{{#summary}} #{{{.}}}
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
p result{{/returnType}}
rescue {{{moduleName}}}::ApiError => e
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"

View File

@ -78,6 +78,7 @@ Class | Method | HTTP request | Description
*Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*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_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
@ -115,7 +116,6 @@ Class | Method | HTTP request | Description
- [Petstore::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Petstore::ArrayTest](docs/ArrayTest.md)
- [Petstore::Body4](docs/Body4.md)
- [Petstore::Capitalization](docs/Capitalization.md)
- [Petstore::Cat](docs/Cat.md)
- [Petstore::Category](docs/Category.md)

View File

@ -47,7 +47,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json

View File

@ -8,6 +8,7 @@ Method | HTTP request | Description
[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
@ -29,7 +30,7 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
opts = {
body: true # BOOLEAN | Input boolean as post body
boolean_post_body: true # BOOLEAN | Input boolean as post body
}
begin
@ -44,7 +45,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **BOOLEAN**| Input boolean as post body | [optional]
**boolean_post_body** | **BOOLEAN**| Input boolean as post body | [optional]
### Return type
@ -56,7 +57,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: */*
@ -102,7 +103,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: */*
@ -148,7 +149,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: */*
@ -194,11 +195,54 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: */*
# **test_body_with_query_params**
> test_body_with_query_params(query, user)
### Example
```ruby
# load the gem
require 'petstore'
api_instance = Petstore::FakeApi.new
query = 'query_example' # String |
user = Petstore::User.new # User |
begin
api_instance.test_body_with_query_params(query, user)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_body_with_query_params: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query** | **String**| |
**user** | [**User**](User.md)| |
### Return type
nil (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
# **test_client_model**
> Client test_client_model(client)
@ -239,7 +283,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json
@ -337,11 +381,11 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
opts = {
enum_header_string_array: ['enum_header_string_array_example'], # Array<String> | Header parameter enum test (string array)
enum_header_string: 'enum_header_string_example', # String | Header parameter enum test (string)
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: 'enum_query_string_example', # String | Query parameter enum test (string)
enum_query_string: '-efg', # String | Query parameter enum test (string)
enum_query_integer: 56, # Integer | Query parameter enum test (double)
enum_query_double: 1.2, # Float | Query parameter enum test (double)
enum_query_double: 3.4, # Float | Query parameter enum test (double)
enum_form_string_array: nil, # Array<String> | Form parameter enum test (string array)
enum_form_string: 'enum_form_string_example' # String | Form parameter enum test (string)
}
@ -359,9 +403,9 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enum_header_string_array** | [**Array&lt;String&gt;**](String.md)| Header parameter enum test (string array) | [optional]
**enum_header_string** | **String**| Header parameter enum test (string) | [optional]
**enum_header_string** | **String**| Header parameter enum test (string) | [optional] [default to -efg]
**enum_query_string_array** | [**Array&lt;String&gt;**](String.md)| Query parameter enum test (string array) | [optional]
**enum_query_string** | **String**| Query parameter enum test (string) | [optional]
**enum_query_string** | **String**| Query parameter enum test (string) | [optional] [default to -efg]
**enum_query_integer** | **Integer**| Query parameter enum test (double) | [optional]
**enum_query_double** | **Float**| Query parameter enum test (double) | [optional]
**enum_form_string_array** | [**Array&lt;String&gt;**](Array.md)| Form parameter enum test (string array) | [optional]
@ -383,7 +427,7 @@ No authorization required
# **test_inline_additional_properties**
> test_inline_additional_properties(unknown_base_type)
> test_inline_additional_properties(request_body)
test inline additionalProperties
@ -393,11 +437,11 @@ test inline additionalProperties
require 'petstore'
api_instance = Petstore::FakeApi.new
unknown_base_type = Petstore::UNKNOWN_BASE_TYPE.new # Hash<String, String> | request body
request_body = {'key' => 'request_body_example'} # String | request body
begin
#test inline additionalProperties
api_instance.test_inline_additional_properties(unknown_base_type)
api_instance.test_inline_additional_properties(request_body)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_inline_additional_properties: #{e}"
end
@ -407,7 +451,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**unknown_base_type** | [**Hash&lt;String, String&gt;**](UNKNOWN_BASE_TYPE.md)| request body |
**request_body** | [**String**](String.md)| request body |
### Return type
@ -425,7 +469,7 @@ No authorization required
# **test_json_form_data**
> test_json_form_data(opts)
> test_json_form_data(param, param2)
test json serialization of form data
@ -435,13 +479,12 @@ test json serialization of form data
require 'petstore'
api_instance = Petstore::FakeApi.new
opts = {
body4: Petstore::Body4.new # Body4 |
}
param = 'param_example' # String | field1
param2 = 'param2_example' # String | field2
begin
#test json serialization of form data
api_instance.test_json_form_data(opts)
api_instance.test_json_form_data(param, param2)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_json_form_data: #{e}"
end
@ -451,7 +494,8 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body4** | [**Body4**](Body4.md)| | [optional]
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
@ -463,7 +507,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined

View File

@ -54,7 +54,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json

View File

@ -56,7 +56,7 @@ nil (empty response body)
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
@ -77,7 +77,7 @@ Petstore.configure do |config|
end
api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | Pet id to delete
pet_id = 56 # Integer | Pet id to delete
opts = {
api_key: 'api_key_example' # String |
}
@ -232,7 +232,7 @@ Petstore.configure do |config|
end
api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | ID of pet to return
pet_id = 56 # Integer | ID of pet to return
begin
#Find pet by ID
@ -306,7 +306,7 @@ nil (empty response body)
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
@ -327,7 +327,7 @@ Petstore.configure do |config|
end
api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | ID of pet that needs to be updated
pet_id = 56 # Integer | ID of pet that needs to be updated
opts = {
name: 'name_example', # String | Updated name of the pet
status: 'status_example' # String | Updated status of the pet
@ -380,7 +380,7 @@ Petstore.configure do |config|
end
api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | ID of pet to update
pet_id = 56 # Integer | ID of pet to update
opts = {
additional_metadata: 'additional_metadata_example', # String | Additional data to pass to server
file: File.new('/path/to/file') # File | file to upload

View File

@ -115,7 +115,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
require 'petstore'
api_instance = Petstore::StoreApi.new
order_id = 789 # Integer | ID of pet that needs to be fetched
order_id = 56 # Integer | ID of pet that needs to be fetched
begin
#Find purchase order by ID
@ -185,7 +185,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json

View File

@ -53,7 +53,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: Not defined
@ -69,7 +69,7 @@ Creates list of users with given input array
require 'petstore'
api_instance = Petstore::UserApi.new
user = [Petstore::User.new] # Array<User> | List of user object
user = nil # Array<User> | List of user object
begin
#Creates list of users with given input array
@ -83,7 +83,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**Array&lt;User&gt;**](User.md)| List of user object |
**user** | [**Array&lt;User&gt;**](Array.md)| List of user object |
### Return type
@ -111,7 +111,7 @@ Creates list of users with given input array
require 'petstore'
api_instance = Petstore::UserApi.new
user = [Petstore::User.new] # Array<User> | List of user object
user = nil # Array<User> | List of user object
begin
#Creates list of users with given input array
@ -125,7 +125,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**Array&lt;User&gt;**](User.md)| List of user object |
**user** | [**Array&lt;User&gt;**](Array.md)| List of user object |
### Return type
@ -353,7 +353,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: Not defined

View File

@ -24,7 +24,6 @@ require 'petstore/models/api_response'
require 'petstore/models/array_of_array_of_number_only'
require 'petstore/models/array_of_number_only'
require 'petstore/models/array_test'
require 'petstore/models/body4'
require 'petstore/models/capitalization'
require 'petstore/models/cat'
require 'petstore/models/category'

View File

@ -52,6 +52,8 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}

View File

@ -21,7 +21,7 @@ module Petstore
end
# Test serialization of outer boolean types
# @param [Hash] opts the optional parameters
# @option opts [BOOLEAN] :body Input boolean as post body
# @option opts [BOOLEAN] :boolean_post_body Input boolean as post body
# @return [OuterBoolean]
def fake_outer_boolean_serialize(opts = {})
data, _status_code, _headers = fake_outer_boolean_serialize_with_http_info(opts)
@ -30,7 +30,7 @@ module Petstore
# Test serialization of outer boolean types
# @param [Hash] opts the optional parameters
# @option opts [BOOLEAN] :body Input boolean as post body
# @option opts [BOOLEAN] :boolean_post_body Input boolean as post body
# @return [Array<(OuterBoolean, Fixnum, Hash)>] OuterBoolean data, response status code and response headers
def fake_outer_boolean_serialize_with_http_info(opts = {})
if @api_client.config.debugging
@ -46,14 +46,12 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'body'])
post_body = @api_client.object_to_http_body(opts[:'boolean_post_body'])
auth_names = []
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
@ -94,8 +92,6 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
@ -142,8 +138,6 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
@ -190,8 +184,6 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
@ -211,6 +203,60 @@ module Petstore
end
return data, status_code, headers
end
# @param query
# @param user
# @param [Hash] opts the optional parameters
# @return [nil]
def test_body_with_query_params(query, user, opts = {})
test_body_with_query_params_with_http_info(query, user, opts)
nil
end
# @param query
# @param user
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
def test_body_with_query_params_with_http_info(query, user, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_query_params ...'
end
# verify the required parameter 'query' is set
if @api_client.config.client_side_validation && query.nil?
fail ArgumentError, "Missing the required parameter 'query' when calling FakeApi.test_body_with_query_params"
end
# verify the required parameter 'user' is set
if @api_client.config.client_side_validation && user.nil?
fail ArgumentError, "Missing the required parameter 'user' when calling FakeApi.test_body_with_query_params"
end
# resource path
local_var_path = '/fake/body-with-query-params'
# query parameters
query_params = {}
query_params[:'query'] = query
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(user)
auth_names = []
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# To test \"client\" model
# To test \"client\" model
# @param client client model
@ -244,6 +290,8 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
@ -336,6 +384,10 @@ module Petstore
if @api_client.config.client_side_validation && pattern_without_delimiter.nil?
fail ArgumentError, "Missing the required parameter 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters"
end
if @api_client.config.client_side_validation && 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
if @api_client.config.client_side_validation && byte.nil?
fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters"
@ -360,6 +412,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 @api_client.config.client_side_validation && !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 @api_client.config.client_side_validation && !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
@ -414,9 +470,9 @@ module Petstore
# To test enum parameters
# @param [Hash] opts the optional parameters
# @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 [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)
# @option opts [String] :enum_query_string Query parameter enum test (string) (default to -efg)
# @option opts [Integer] :enum_query_integer Query parameter enum test (double)
# @option opts [Float] :enum_query_double Query parameter enum test (double)
# @option opts [Array<String>] :enum_form_string_array Form parameter enum test (string array)
@ -443,14 +499,14 @@ module Petstore
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_enum_parameters ...'
end
if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all? { |item| ['>', '$'].include?(item) }
fail ArgumentError, 'invalid value for "enum_header_string_array", must include one of >, $'
if @api_client.config.client_side_validation && 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 @api_client.config.client_side_validation && 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 @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all? { |item| ['>', '$'].include?(item) }
fail ArgumentError, 'invalid value for "enum_query_string_array", must include one of >, $'
if @api_client.config.client_side_validation && 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 @api_client.config.client_side_validation && 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)'
@ -472,7 +528,7 @@ module Petstore
# query parameters
query_params = {}
query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :multi) if !opts[:'enum_query_string_array'].nil?
query_params[:'enum_query_string_array'] = opts[:'enum_query_string_array'] 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?
query_params[:'enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil?
@ -481,7 +537,7 @@ module Petstore
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
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_array'] = opts[:'enum_header_string_array'] if !opts[:'enum_header_string_array'].nil?
header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil?
# form parameters
@ -504,25 +560,25 @@ module Petstore
return data, status_code, headers
end
# test inline additionalProperties
# @param unknown_base_type request body
# @param request_body request body
# @param [Hash] opts the optional parameters
# @return [nil]
def test_inline_additional_properties(unknown_base_type, opts = {})
test_inline_additional_properties_with_http_info(unknown_base_type, opts)
def test_inline_additional_properties(request_body, opts = {})
test_inline_additional_properties_with_http_info(request_body, opts)
nil
end
# test inline additionalProperties
# @param unknown_base_type request body
# @param request_body request body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
def test_inline_additional_properties_with_http_info(unknown_base_type, opts = {})
def test_inline_additional_properties_with_http_info(request_body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_inline_additional_properties ...'
end
# verify the required parameter 'unknown_base_type' is set
if @api_client.config.client_side_validation && unknown_base_type.nil?
fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling FakeApi.test_inline_additional_properties"
# verify the required parameter 'request_body' is set
if @api_client.config.client_side_validation && request_body.nil?
fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_inline_additional_properties"
end
# resource path
local_var_path = '/fake/inline-additionalProperties'
@ -539,7 +595,7 @@ module Petstore
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(unknown_base_type)
post_body = @api_client.object_to_http_body(request_body)
auth_names = []
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
@ -553,22 +609,32 @@ module Petstore
return data, status_code, headers
end
# test json serialization of form data
# @param param field1
# @param param2 field2
# @param [Hash] opts the optional parameters
# @option opts [Body4] :body4
# @return [nil]
def test_json_form_data(opts = {})
test_json_form_data_with_http_info(opts)
def test_json_form_data(param, param2, opts = {})
test_json_form_data_with_http_info(param, param2, opts)
nil
end
# test json serialization of form data
# @param param field1
# @param param2 field2
# @param [Hash] opts the optional parameters
# @option opts [Body4] :body4
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
def test_json_form_data_with_http_info(opts = {})
def test_json_form_data_with_http_info(param, param2, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_json_form_data ...'
end
# verify the required parameter 'param' is set
if @api_client.config.client_side_validation && param.nil?
fail ArgumentError, "Missing the required parameter 'param' when calling FakeApi.test_json_form_data"
end
# verify the required parameter 'param2' is set
if @api_client.config.client_side_validation && param2.nil?
fail ArgumentError, "Missing the required parameter 'param2' when calling FakeApi.test_json_form_data"
end
# resource path
local_var_path = '/fake/jsonFormData'
@ -578,13 +644,15 @@ module Petstore
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
# form parameters
form_params = {}
form_params['param'] = param
form_params['param2'] = param2
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'body4'])
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,

View File

@ -52,6 +52,8 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}

View File

@ -48,6 +48,8 @@ module Petstore
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
# form parameters
form_params = {}
@ -144,7 +146,7 @@ module Petstore
# query parameters
query_params = {}
query_params[:'status'] = @api_client.build_collection_param(status, :csv)
query_params[:'status'] = status
# header parameters
header_params = {}
@ -197,7 +199,7 @@ module Petstore
# query parameters
query_params = {}
query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)
query_params[:'tags'] = tags
# header parameters
header_params = {}
@ -303,6 +305,8 @@ module Petstore
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
# form parameters
form_params = {}

View File

@ -205,8 +205,6 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}

View File

@ -50,8 +50,6 @@ module Petstore
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
@ -399,8 +397,6 @@ module Petstore
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}

View File

@ -187,10 +187,18 @@ module Petstore
invalid_properties.push('invalid value for "double", must be greater than or equal to 67.8.')
end
if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
invalid_properties.push('invalid value for "string", must conform to the pattern /[a-z]/i.')
end
if @byte.nil?
invalid_properties.push('invalid value for "byte", byte cannot be nil.')
end
if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
invalid_properties.push('invalid value for "byte", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
end
if @date.nil?
invalid_properties.push('invalid value for "date", date cannot be nil.')
end
@ -224,7 +232,9 @@ module Petstore
return false if !@float.nil? && @float < 54.3
return false if !@double.nil? && @double > 123.4
return false if !@double.nil? && @double < 67.8
return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
return false if @byte.nil?
return false if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
return false if @date.nil?
return false if @password.nil?
return false if @password.to_s.length > 64
@ -306,6 +316,30 @@ module Petstore
@double = double
end
# Custom attribute writer method with validation
# @param [Object] string Value to be assigned
def string=(string)
if !string.nil? && string !~ Regexp.new(/[a-z]/i)
fail ArgumentError, 'invalid value for "string", must conform to the pattern /[a-z]/i.'
end
@string = string
end
# Custom attribute writer method with validation
# @param [Object] byte Value to be assigned
def byte=(byte)
if byte.nil?
fail ArgumentError, 'byte cannot be nil'
end
if byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
fail ArgumentError, 'invalid value for "byte", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
end
@byte = byte
end
# Custom attribute writer method with validation
# @param [Object] password Value to be assigned
def password=(password)

View File

@ -1 +1 @@
2.3.0-SNAPSHOT
3.0.0-SNAPSHOT

File diff suppressed because one or more lines are too long