96
96
BODY_PARAMETER_DEFAULT_VALUE = {
97
97
'description' : 'The request body.' ,
98
98
'type' : 'object' ,
99
- 'required' : True ,
100
99
}
101
100
MEDIA_BODY_PARAMETER_DEFAULT_VALUE = {
102
101
'description' : ('The filename of the media request body, or an instance '
@@ -494,9 +493,6 @@ def _fix_up_parameters(method_desc, root_desc, http_method, schema):
494
493
if http_method in HTTP_PAYLOAD_METHODS and 'request' in method_desc :
495
494
body = BODY_PARAMETER_DEFAULT_VALUE .copy ()
496
495
body .update (method_desc ['request' ])
497
- # Make body optional for requests with no parameters.
498
- if not _methodProperties (method_desc , schema , 'request' ):
499
- body ['required' ] = False
500
496
parameters ['body' ] = body
501
497
502
498
return parameters
@@ -505,10 +501,8 @@ def _fix_up_parameters(method_desc, root_desc, http_method, schema):
505
501
def _fix_up_media_upload (method_desc , root_desc , path_url , parameters ):
506
502
"""Adds 'media_body' and 'media_mime_type' parameters if supported by method.
507
503
508
- SIDE EFFECTS: If the method supports media upload and has a required body,
509
- sets body to be optional (required=False) instead. Also, if there is a
510
- 'mediaUpload' in the method description, adds 'media_upload' key to
511
- parameters.
504
+ SIDE EFFECTS: If there is a 'mediaUpload' in the method description, adds
505
+ 'media_upload' key to parameters.
512
506
513
507
Args:
514
508
method_desc: Dictionary with metadata describing an API method. Value comes
@@ -541,8 +535,6 @@ def _fix_up_media_upload(method_desc, root_desc, path_url, parameters):
541
535
media_path_url = _media_path_url_from_info (root_desc , path_url )
542
536
parameters ['media_body' ] = MEDIA_BODY_PARAMETER_DEFAULT_VALUE .copy ()
543
537
parameters ['media_mime_type' ] = MEDIA_MIME_TYPE_PARAMETER_DEFAULT_VALUE .copy ()
544
- if 'body' in parameters :
545
- parameters ['body' ]['required' ] = False
546
538
547
539
return accept , max_size , media_path_url
548
540
0 commit comments