Azure / Azure/azure-rest-api-specs

[BUG] OpenAI TypeSpec should not include the "filename" part in multipart/form-data API

Open
#28,905 1 comment 0 reactions 1 assignee Claimed by @iscai-msft View on GitHub
bug DataPlane
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/OpenAI.Assistants/files/routes.tsp#L50-L57

### API Spec version

2024-02-15-preview

### Describe the bug

The "filename" of a File should not be in multipart/form-data model.

Same in
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp#L48-L53

In [TypeSpec design](https://github.com/microsoft/typespec/issues/3046), the part would be written as
```
HttpPart,
```
And the filename is included in the File.

### Expected behavior

This "filename" should not be in model or method.

It is up to SDK emitter to determine, how to let user to set a "filename" for the File.

```
0000: --------------------------NWdLREXJ51lgZwiipJsqHR
0032: Content-Disposition: form-data; name="file"; filename=
005f: Content-Type: application/octet-stream
0087:
0089: The word 'apple' uses the code 442345, while the word 'banana' u
00c9: ses the code 673457.
```

### Actual behavior

This extra "filename" part.

Java had to customize the method signature to remove it. https://github.com/Azure/azure-sdk-for-java/pull/38698

Assistants backend would error, if `filename` is sent as part.
```
{
"error": {
"message": "Additional properties are not allowed ('filename' was unexpected)",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
```

### Reproduction Steps

NOOP

### Environment

_No response_

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.