Azure / Azure/azure-rest-api-specs

[Support] Investigate how TypeSpec and ModelValidation handle multipart/form-data

Open
#34,612 0 comments 0 reactions 1 assignee Claimed by @mikeharder View on GitHub
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 37m
Merged PRs (30d)
446

Description

## Failing Check
https://github.com/Azure/azure-rest-api-specs/pull/34582/checks?check_run_id=42022350962

## TypeSpec
```
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation"
#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations"
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
#suppress "@azure-tools/typespec-azure-core/byos" "mirrored API"
@post
uploadFile is Azure.Core.Foundations.Operation<
{
@doc("The name of the file to upload.")
@header
contentType: "multipart/form-data";

/** Multipart body */
@multipartBody body: {
@doc("The file data, in bytes.")
@clientName("Data", "csharp")
file: HttpPart;

@doc("The intended purpose of the uploaded file. Use `assistants` for Agents and Message files, `vision` for Agents image file inputs, `batch` for Batch API, and `fine-tune` for Fine-tuning.")
purpose: HttpPart;

/*
* Spec note: filename is not documented as a distinct option but functionally should be one. The value is encoded
* in the multipart Content-Disposition header for the data section and can be provided independently of
* any specific data source like a file. It can be inferred in some circumstances (as when using direct
* file input, like curl does) but should remain configurable when using a stream or other data source
* lacking an a priori name.
*/
@doc("The name of the file.")
filename?: HttpPart;
};
},
FileInfo
>;
```

https://github.com/Azure/azure-rest-api-specs/blob/feature/azure-ai-agents-v1/specification/ai/Azure.AI.Agents/files/routes.tsp#L52-L80

## Teams Discussion
https://teams.microsoft.com/l/message/19:906c1efbbec54dc8949ac736633e6bdf@thread.skype/1747069783003?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&parentMessageId=1747069783003&teamName=Azure%20SDK&channelName=TypeSpec%20Discussion&createdTime=1747069783003

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.