fix required parameter check (#16628)

This commit is contained in:
William Cheng
2023-09-20 17:05:55 +08:00
committed by GitHub
parent 25b67dd6bf
commit 16c6cff28f
13 changed files with 92 additions and 92 deletions

View File

@@ -187,7 +187,7 @@ class {{classname}}:
# process the path parameters
_path_params = {}
{{#pathParams}}
if _params['{{paramName}}']:
if _params['{{paramName}}'] is not None:
_path_params['{{baseName}}'] = _params['{{paramName}}']
{{#isArray}}
_collection_formats['{{baseName}}'] = '{{collectionFormat}}'
@@ -224,7 +224,7 @@ class {{classname}}:
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
{{#headerParams}}
if _params['{{paramName}}']:
if _params['{{paramName}}'] is not None:
_header_params['{{baseName}}'] = _params['{{paramName}}']
{{#isArray}}
_collection_formats['{{baseName}}'] = '{{collectionFormat}}'
@@ -235,7 +235,7 @@ class {{classname}}:
_form_params = []
_files = {}
{{#formParams}}
if _params['{{paramName}}']:
if _params['{{paramName}}'] is not None:
{{^isFile}}
_form_params.append(('{{{baseName}}}', _params['{{paramName}}']))
{{/isFile}}

View File

@@ -438,7 +438,7 @@ class BodyApi:
# process the form parameters
_form_params = []
_files = {}
if _params['files']:
if _params['files'] is not None:
_files['files'] = _params['files']
_collection_formats['files'] = 'csv'

View File

@@ -161,13 +161,13 @@ class FormApi:
# process the form parameters
_form_params = []
_files = {}
if _params['integer_form']:
if _params['integer_form'] is not None:
_form_params.append(('integer_form', _params['integer_form']))
if _params['boolean_form']:
if _params['boolean_form'] is not None:
_form_params.append(('boolean_form', _params['boolean_form']))
if _params['string_form']:
if _params['string_form'] is not None:
_form_params.append(('string_form', _params['string_form']))
# process the body parameter
@@ -339,22 +339,22 @@ class FormApi:
# process the form parameters
_form_params = []
_files = {}
if _params['form1']:
if _params['form1'] is not None:
_form_params.append(('form1', _params['form1']))
if _params['form2']:
if _params['form2'] is not None:
_form_params.append(('form2', _params['form2']))
if _params['form3']:
if _params['form3'] is not None:
_form_params.append(('form3', _params['form3']))
if _params['form4']:
if _params['form4'] is not None:
_form_params.append(('form4', _params['form4']))
if _params['id']:
if _params['id'] is not None:
_form_params.append(('id', _params['id']))
if _params['name']:
if _params['name'] is not None:
_form_params.append(('name', _params['name']))
# process the body parameter

View File

@@ -158,13 +158,13 @@ class HeaderApi:
_query_params = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['integer_header']:
if _params['integer_header'] is not None:
_header_params['integer_header'] = _params['integer_header']
if _params['boolean_header']:
if _params['boolean_header'] is not None:
_header_params['boolean_header'] = _params['boolean_header']
if _params['string_header']:
if _params['string_header'] is not None:
_header_params['string_header'] = _params['string_header']
# process the form parameters

View File

@@ -146,10 +146,10 @@ class PathApi:
# process the path parameters
_path_params = {}
if _params['path_string']:
if _params['path_string'] is not None:
_path_params['path_string'] = _params['path_string']
if _params['path_integer']:
if _params['path_integer'] is not None:
_path_params['path_integer'] = _params['path_integer']

View File

@@ -509,7 +509,7 @@ class FakeApi:
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['header_1']:
if _params['header_1'] is not None:
_header_params['header_1'] = _params['header_1']
# process the form parameters
@@ -2239,49 +2239,49 @@ class FakeApi:
# process the form parameters
_form_params = []
_files = {}
if _params['integer']:
if _params['integer'] is not None:
_form_params.append(('integer', _params['integer']))
if _params['int32']:
if _params['int32'] is not None:
_form_params.append(('int32', _params['int32']))
if _params['int64']:
if _params['int64'] is not None:
_form_params.append(('int64', _params['int64']))
if _params['number']:
if _params['number'] is not None:
_form_params.append(('number', _params['number']))
if _params['float']:
if _params['float'] is not None:
_form_params.append(('float', _params['float']))
if _params['double']:
if _params['double'] is not None:
_form_params.append(('double', _params['double']))
if _params['string']:
if _params['string'] is not None:
_form_params.append(('string', _params['string']))
if _params['pattern_without_delimiter']:
if _params['pattern_without_delimiter'] is not None:
_form_params.append(('pattern_without_delimiter', _params['pattern_without_delimiter']))
if _params['byte']:
if _params['byte'] is not None:
_form_params.append(('byte', _params['byte']))
if _params['binary']:
if _params['binary'] is not None:
_files['binary'] = _params['binary']
if _params['byte_with_max_length']:
if _params['byte_with_max_length'] is not None:
_form_params.append(('byte_with_max_length', _params['byte_with_max_length']))
if _params['var_date']:
if _params['var_date'] is not None:
_form_params.append(('date', _params['var_date']))
if _params['date_time']:
if _params['date_time'] is not None:
_form_params.append(('dateTime', _params['date_time']))
if _params['password']:
if _params['password'] is not None:
_form_params.append(('password', _params['password']))
if _params['param_callback']:
if _params['param_callback'] is not None:
_form_params.append(('callback', _params['param_callback']))
# process the body parameter
@@ -2440,10 +2440,10 @@ class FakeApi:
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['required_boolean_group']:
if _params['required_boolean_group'] is not None:
_header_params['required_boolean_group'] = _params['required_boolean_group']
if _params['boolean_group']:
if _params['boolean_group'] is not None:
_header_params['boolean_group'] = _params['boolean_group']
# process the form parameters
@@ -2694,10 +2694,10 @@ class FakeApi:
# process the form parameters
_form_params = []
_files = {}
if _params['param']:
if _params['param'] is not None:
_form_params.append(('param', _params['param']))
if _params['param2']:
if _params['param2'] is not None:
_form_params.append(('param2', _params['param2']))
# process the body parameter

View File

@@ -261,7 +261,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -269,7 +269,7 @@ class PetApi:
_query_params = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['api_key']:
if _params['api_key'] is not None:
_header_params['api_key'] = _params['api_key']
# process the form parameters
@@ -636,7 +636,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -897,7 +897,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -908,10 +908,10 @@ class PetApi:
# process the form parameters
_form_params = []
_files = {}
if _params['name']:
if _params['name'] is not None:
_form_params.append(('name', _params['name']))
if _params['status']:
if _params['status'] is not None:
_form_params.append(('status', _params['status']))
# process the body parameter
@@ -1038,7 +1038,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -1049,10 +1049,10 @@ class PetApi:
# process the form parameters
_form_params = []
_files = {}
if _params['additional_metadata']:
if _params['additional_metadata'] is not None:
_form_params.append(('additionalMetadata', _params['additional_metadata']))
if _params['file']:
if _params['file'] is not None:
_files['file'] = _params['file']
# process the body parameter
@@ -1185,7 +1185,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -1196,10 +1196,10 @@ class PetApi:
# process the form parameters
_form_params = []
_files = {}
if _params['additional_metadata']:
if _params['additional_metadata'] is not None:
_form_params.append(('additionalMetadata', _params['additional_metadata']))
if _params['required_file']:
if _params['required_file'] is not None:
_files['requiredFile'] = _params['required_file']
# process the body parameter

View File

@@ -130,7 +130,7 @@ class StoreApi:
# process the path parameters
_path_params = {}
if _params['order_id']:
if _params['order_id'] is not None:
_path_params['order_id'] = _params['order_id']
@@ -364,7 +364,7 @@ class StoreApi:
# process the path parameters
_path_params = {}
if _params['order_id']:
if _params['order_id'] is not None:
_path_params['order_id'] = _params['order_id']

View File

@@ -518,7 +518,7 @@ class UserApi:
# process the path parameters
_path_params = {}
if _params['username']:
if _params['username'] is not None:
_path_params['username'] = _params['username']
@@ -636,7 +636,7 @@ class UserApi:
# process the path parameters
_path_params = {}
if _params['username']:
if _params['username'] is not None:
_path_params['username'] = _params['username']
@@ -1010,7 +1010,7 @@ class UserApi:
# process the path parameters
_path_params = {}
if _params['username']:
if _params['username'] is not None:
_path_params['username'] = _params['username']

View File

@@ -571,7 +571,7 @@ class FakeApi:
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['header_1']:
if _params['header_1'] is not None:
_header_params['header_1'] = _params['header_1']
# process the form parameters
@@ -2509,49 +2509,49 @@ class FakeApi:
# process the form parameters
_form_params = []
_files = {}
if _params['integer']:
if _params['integer'] is not None:
_form_params.append(('integer', _params['integer']))
if _params['int32']:
if _params['int32'] is not None:
_form_params.append(('int32', _params['int32']))
if _params['int64']:
if _params['int64'] is not None:
_form_params.append(('int64', _params['int64']))
if _params['number']:
if _params['number'] is not None:
_form_params.append(('number', _params['number']))
if _params['float']:
if _params['float'] is not None:
_form_params.append(('float', _params['float']))
if _params['double']:
if _params['double'] is not None:
_form_params.append(('double', _params['double']))
if _params['string']:
if _params['string'] is not None:
_form_params.append(('string', _params['string']))
if _params['pattern_without_delimiter']:
if _params['pattern_without_delimiter'] is not None:
_form_params.append(('pattern_without_delimiter', _params['pattern_without_delimiter']))
if _params['byte']:
if _params['byte'] is not None:
_form_params.append(('byte', _params['byte']))
if _params['binary']:
if _params['binary'] is not None:
_files['binary'] = _params['binary']
if _params['byte_with_max_length']:
if _params['byte_with_max_length'] is not None:
_form_params.append(('byte_with_max_length', _params['byte_with_max_length']))
if _params['var_date']:
if _params['var_date'] is not None:
_form_params.append(('date', _params['var_date']))
if _params['date_time']:
if _params['date_time'] is not None:
_form_params.append(('dateTime', _params['date_time']))
if _params['password']:
if _params['password'] is not None:
_form_params.append(('password', _params['password']))
if _params['param_callback']:
if _params['param_callback'] is not None:
_form_params.append(('callback', _params['param_callback']))
# process the body parameter
@@ -2726,10 +2726,10 @@ class FakeApi:
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['required_boolean_group']:
if _params['required_boolean_group'] is not None:
_header_params['required_boolean_group'] = _params['required_boolean_group']
if _params['boolean_group']:
if _params['boolean_group'] is not None:
_header_params['boolean_group'] = _params['boolean_group']
# process the form parameters
@@ -3012,10 +3012,10 @@ class FakeApi:
# process the form parameters
_form_params = []
_files = {}
if _params['param']:
if _params['param'] is not None:
_form_params.append(('param', _params['param']))
if _params['param2']:
if _params['param2'] is not None:
_form_params.append(('param2', _params['param2']))
# process the body parameter

View File

@@ -291,7 +291,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -299,7 +299,7 @@ class PetApi:
_query_params = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['api_key']:
if _params['api_key'] is not None:
_header_params['api_key'] = _params['api_key']
# process the form parameters
@@ -714,7 +714,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -1007,7 +1007,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -1018,10 +1018,10 @@ class PetApi:
# process the form parameters
_form_params = []
_files = {}
if _params['name']:
if _params['name'] is not None:
_form_params.append(('name', _params['name']))
if _params['status']:
if _params['status'] is not None:
_form_params.append(('status', _params['status']))
# process the body parameter
@@ -1164,7 +1164,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -1175,10 +1175,10 @@ class PetApi:
# process the form parameters
_form_params = []
_files = {}
if _params['additional_metadata']:
if _params['additional_metadata'] is not None:
_form_params.append(('additionalMetadata', _params['additional_metadata']))
if _params['file']:
if _params['file'] is not None:
_files['file'] = _params['file']
# process the body parameter
@@ -1327,7 +1327,7 @@ class PetApi:
# process the path parameters
_path_params = {}
if _params['pet_id']:
if _params['pet_id'] is not None:
_path_params['petId'] = _params['pet_id']
@@ -1338,10 +1338,10 @@ class PetApi:
# process the form parameters
_form_params = []
_files = {}
if _params['additional_metadata']:
if _params['additional_metadata'] is not None:
_form_params.append(('additionalMetadata', _params['additional_metadata']))
if _params['required_file']:
if _params['required_file'] is not None:
_files['requiredFile'] = _params['required_file']
# process the body parameter

View File

@@ -144,7 +144,7 @@ class StoreApi:
# process the path parameters
_path_params = {}
if _params['order_id']:
if _params['order_id'] is not None:
_path_params['order_id'] = _params['order_id']
@@ -410,7 +410,7 @@ class StoreApi:
# process the path parameters
_path_params = {}
if _params['order_id']:
if _params['order_id'] is not None:
_path_params['order_id'] = _params['order_id']

View File

@@ -580,7 +580,7 @@ class UserApi:
# process the path parameters
_path_params = {}
if _params['username']:
if _params['username'] is not None:
_path_params['username'] = _params['username']
@@ -714,7 +714,7 @@ class UserApi:
# process the path parameters
_path_params = {}
if _params['username']:
if _params['username'] is not None:
_path_params['username'] = _params['username']
@@ -1136,7 +1136,7 @@ class UserApi:
# process the path parameters
_path_params = {}
if _params['username']:
if _params['username'] is not None:
_path_params['username'] = _params['username']