Unfortunately only the inline schema definition of Documentsv1 lets NSwag generate a valid client:
public async Task Documentsv1Async(System.IO.Stream body, ...) {
//..
var content_ = new System.Net.Http.StreamContent(body);
Documentsv2 and Documentsv3 will fail on runtime as they both try to serialize the body to JSON first before passing it into the StringContent constructor:
public async Task Documentsv2Async(FileParameter body, ...) {
//..
var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value));
and
public async Task Documentsv3Async(object body, ...) {
//..
var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value));
It's like that the last 2 requests "forgot" that the schema indirectly demands for binary and not byte. Could you fix this issues or if I get something wrong help me to address to real issuer of the problem?
(I'm really sorry to tell you we need to swallow the 2nd version of file upload generation because the Azure API Management returns it that way no matter if the API behind provides inline or $ref schema types. 😥)
Here we have 3 valid OpenApi v3 specifications for a file upload:
Unfortunately only the inline schema definition of
Documentsv1
lets NSwag generate a valid client:Documentsv2
andDocumentsv3
will fail on runtime as they both try to serialize the body to JSON first before passing it into theStringContent
constructor:and
It's like that the last 2 requests "forgot" that the schema indirectly demands for
binary
and notbyte
. Could you fix this issues or if I get something wrong help me to address to real issuer of the problem?(I'm really sorry to tell you we need to swallow the 2nd version of file upload generation because the Azure API Management returns it that way no matter if the API behind provides inline or
$ref
schema types. 😥)NSwag Studio v13.11.3.0