Open annelo-msft opened 3 weeks ago
Currently in order to generate the content type and a binary upload method that doesn't serialize a model, the tsp would need to look like this - note we add the contentType header and body decorator:
interface PutBytesClient {
@put @route("upload") Upload(@header contentType: "application/octet-stream", @body document: bytes) : void;
}
/cc @schaabs for thoughts on the tsp requirements mentioned in previous comment.
Adding the context that @KrzysztofCwalina raised the concern with me directly that those decorators would need to be added to obtain a client that used the headers and didn't write those models.
I am happy to defer to @schaabs and @KrzysztofCwalina regarding whether that is the TypeSpec we would like customers/partners to need to write in order to have our .NET generator write a client that can upload application/octet-stream bytes to a service. For me personally, I would wonder the following about:
@put @route("upload") Upload(document: bytes) : void;
bytes
would need a model to support it for the most common case?
As part of determining the tsp -> C# story, we should keep in mind what the experience would look like across other language generators. It would be odd if a single tsp generated semantically different clients across the languages that we support, which makes me wonder if these type of inferences would be better to make further upstream in TCGC so that all the language emitters get it for free.
TypeSpec file:
Expected client output
A diff of expected generator output compared to current generator output is here: https://github.com/annelo-msft/typespec/pull/2