Azure / Azure/typespec-azure

Revisit generated type for binary bytes

Open
#4,712 0 comments 0 reactions 1 assignee Assigned to @qiaozha View on GitHub
emitter:typescript
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

If we get a binary bytes,

in RLC layer,
if it's in input model, we should generate it as `string | Uint8Array | ReadableStream | NodeJS.ReadableStream`,
if it's in output model, we will generate it as `Uint8Array`

in Modular layer,
current implemtation is to treat it as `Uint8Array` regardless input or output.

This could be problematic if there's a large file to upload in the Modular layer. And I am a little concerned if Uint8Array is appropriate if there's a large file to download in RLC ?

we need to revisit how to handle binary bytes in both RLC and Modular in the context of input and output.

Also, do we need to revisit the decision on whether splitting models as input and output in the modular layer ? Given there's a similar discussion about `unknown` being handled differently in the RLC layer between input and output and we are struggling about how to express `unknown` in the Modular layer. see details from https://github.com/Azure/autorest.typescript/issues/2078

/cc @xirzec @joheredi

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.