[C# Client] Binary string parameters not supported?
See original GitHub issueHi.
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?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (8 by maintainers)
Top Results From Across the Web
[C#] csharp client support for 'string/binary' · Issue #1381
Easiest fix is to not support binary file streams, and translate this specification to a byte array ( byte [] ), just like...
Read more >Passing binary data in a string as a COM event parameter
So the reason for the problem problem is a little complex and is rooted in the fact that FoxPro does not support Unicode...
Read more >Post byte array to Web API server using HttpClient
5 Answers. WebAPI v2. 1 and beyond supports BSON (Binary JSON) out of the box, and even has a MediaTypeFormatter included for it....
Read more >Configuring parameters and parameter data types
Command objects use parameters to pass values to SQL statements or stored procedures, providing type checking and validation in ADO.NET.
Read more >11.3.3 The BINARY and VARBINARY Types
The BINARY and VARBINARY types are similar to CHAR and VARCHAR , except that they store binary strings rather than nonbinary strings.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@RSuter Ok, thank you for your quick response. Would you mind listing roughly what needs to be done to support it? I am interested in taking a look at it, but no promises.
Can I assume that this is also unimplemented for C# controllers? I see that string/binary multipart specs in openapi3 result in simple string JSON body objects in the controller code and not in any stream/IFile code?