Open agehling opened 4 years ago
Hey @agehling
Actually, the C# code should also works with a File
class. I guess the best approach here is to set an option to force the use of byte arrays.
Wdyt?
Dear HugoMario,
I think in both (probably all) cases it should generate a byte-array, nothing beyond that. - That would much more reflect the intention.
brgds, Andreas
I agree with @agehling, In documentation https://swagger.io/docs/specification/v3_0/data-models/data-types/#files
is specified that it should be binary content of File, how can be content handled by File type?
Wrong/different types in Java/C# for "type" : "string","format" : "binary" declarations
When we define something like this to transfer binary data we could do it like this:
"transferData" : { "description" : "Any data to be exchanged between callers and callees.", "type" : "string", "format" : "base64" }
The generated code for this is correct for both, C# and Java (both String). – Perfect!
But if we define the following:
"deviceData" : { "type" : "string", "format" : "binary" }
The generated code for C# is correct (public byte[] DeviceData { get; set; }), but for Java a File type is generated (private File deviceData = null;) which is definitely not the intention behind ‘binary’.
3.0.21
The SwaggerHub CodeGen feature for 'java' and 'csharp' were used.
The problematic definition:
creates this Java code: