(request_body)
| 84 | return message |
| 85 | |
| 86 | def convert_openapi_to_params(request_body): |
| 87 | if not request_body: |
| 88 | return [] |
| 89 | params = [] |
| 90 | for content_type, content in request_body['content'].items(): |
| 91 | schema = content['schema'] |
| 92 | properties = schema.get('properties', {}) |
| 93 | required = schema.get('required', []) |
| 94 | for key, value in properties.items(): |
| 95 | param = { |
| 96 | 'name': key, |
| 97 | 'schema': value, |
| 98 | 'required': key in required, |
| 99 | 'description': value.get('description', '') |
| 100 | } |
| 101 | if content_type == 'multipart/form-data' and value.get('format') == 'binary': |
| 102 | param['type'] = 'file' |
| 103 | elif content_type in ['application/x-www-form-urlencoded', 'multipart/form-data']: |
| 104 | param['type'] = 'form' |
| 105 | else: |
| 106 | param['type'] = 'json' |
| 107 | params.append(param) |
| 108 | return params |
| 109 | |
| 110 | async def afunc(json_args): |
| 111 | if isinstance(json_args, str): |
nothing calls this directly
no outgoing calls
no test coverage detected