RicoSuter/NSwag

[C# Client] Binary string parameters not supported?

Open

#1824 aperta il 13 dic 2018

Vedi su GitHub
 (9 commenti) (4 reazioni) (0 assegnatari)C# (1189 fork)batch import
format: OpenAPI 3help wantedproject: NJsonSchema.CodeGeneration.CSharpproject: NJsonSchema.CodeGeneration.TypeScripttype: enhancement

Metriche repository

Star
 (6291 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Hi.

The OpenAPI 3 specification specifies that files can be sent in a request by declaring that a parameters is of the type string with the format binary: https://swagger.io/docs/specification/describing-request-body/file-upload/

The proposed way to send a single file is as shown below:

    requestBody:
      content:
        image/png:
          schema:
            type: string
            format: binary

When generating a C# client, I would expect to give some sort of Stream (e.g. FileStream) or a byte[], but the client wants me to supply a normal string. From what I can understand, this is not what the OpenAPI spec means with "binary string". Are strings of format binary not currently supported? Is support planned?

Guida contributor