-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwaggerProvider and byte array #46
Comments
I am not really sure that we should treat You have an another way to specify arrays...
serialization may be tricky if we decide to convert |
As I understand Swagger spec: As workaround you can convert this string manually using
|
How did you get this schema? Is it public service? Is it auto-generated from .NET API or hand-written? |
@sergey-tihon sorry for delay responses. Interesting this may be a bug with Swashbuckle rather than SwaggerProvider? I wonder if domaindrivendev/Swashbuckle.WebApi#640 has relevance? I checked my version of Swashbuckle that is used on the WebAPI side and it is '0.5.3' with NewtonSoft '9.0.1' The schema was generated automatically using F#+WebAPI using a type similar to the following:
Which was then used on an incoming controller member:
The paket.lock for this controller is:
|
Just to note, on #45 (comment), I generated the C# types using the Microsoft REST Client codegen and it produced the correct 'byte[]' type for this situation. Note2: It ALMOST generated the correct types, it sneakily added this in the It seems that Swashbuckle stuff is not treating these things in a nice way, how do people send data (you cant base64 200MB easily!). Note3: this is interesting domaindrivendev/Swashbuckle.WebApi@03e028c shows that |
Should be fixed in v0.5.4 |
Description
The provider does not generate the correct types for
format : byte
Repro steps
The following JSON can be used to show the problem, note the testBytes property on the TestDirect type.
Saving the above JSON to a file, and referencing it like so:
Hovering over the parameter
e
shows that the type isstring
. Additionally, if we view the binary after compilation using ILSpy, we get the following:Expected behavior
It is expected that the 'TestBytes' property should allow for
byte[]
.Known workarounds
Unfortunately there is no workaround apart from not using SwaggerProvider for the API calls that require byte arrays.
Related information
paket.lock:
The text was updated successfully, but these errors were encountered: