question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[C# Client] Binary string parameters not supported?

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
LangdalPcommented, Dec 13, 2018

@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.

0reactions
plkcommented, Jun 2, 2019

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found