RicoSuter/NSwag

[C# Client] Binary string parameters not supported?

Open

#1.824 geöffnet am 13. Dez. 2018

Auf GitHub ansehen
 (9 Kommentare) (4 Reaktionen) (0 zugewiesene Personen)C# (1.189 Forks)batch import
format: OpenAPI 3help wantedproject: NJsonSchema.CodeGeneration.CSharpproject: NJsonSchema.CodeGeneration.TypeScripttype: enhancement

Repository-Metriken

Stars
 (6.291 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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?

Contributor Guide