microsoft / kiota-python

Abstractions library for Kiota generated Python clients
https://aka.ms/kiota/docs
MIT License
16 stars 11 forks source link

Add `filename` parameter to MultipartBody #400

Closed kaakaa closed 3 weeks ago

kaakaa commented 3 weeks ago

Overview

Add support for MultipartBody filename parameter

Related Issue

Fixes #398

Demo

N/A

Notes

Testing Instructions

# FastAPI's endpoint
@app.post("/upload")
async def upload(name: str = Form(...), file: UploadFile = File(...)) -> int:
    return file.size
OpenAPI Spec ```yaml { "openapi": "3.0.2", "info": { "title": "Custom title", "summary": "This is a very custom OpenAPI schema", "description": "Here's a longer description of the custom **OpenAPI** schema", "version": "3.0.2" }, "paths": { "/": { "get": { "summary": "Root", "operationId": "root__get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "string", "title": "Response Root Get" } } } } } } }, "/upload": { "post": { "summary": "Upload", "operationId": "upload_upload_post", "requestBody": { "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/Body_upload_upload_post" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "integer", "title": "Response Upload Upload Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "Body_upload_upload_post": { "properties": { "name": { "type": "string", "title": "Name" }, "file": { "type": "string", "format": "binary", "title": "File" } }, "type": "object", "required": [ "name", "file" ], "title": "Body_upload_upload_post" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } } ```
sonarcloud[bot] commented 3 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud