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
Just updated to latest AutoRest generated code no longer builds. #2745
Comments
Wait-- do you mean That should not have been used for streams in the first place; there was a bug recently fixed to properly support formData for parameters. You should be using "parameters": [
{
"name": "body",
"in": "body",
"schema": {
"type": "object",
"format": "file"
},
"required": true,
"description": "The file to upload."
},
] |
The swagger looks like this. This was the only way I could find to get the Swashbuckler/AutoRest combination to support streams. I'll try contacting Swashbuckler to see if they have away to generate the
|
@fearthecowboy So using "formData" is the suggested solution in the following thread, so I don't know who to listen to: |
@fearthecowboy To confuse things more, I just took a fiddler dump of what the call to the API looks like, and it is using multipart/form-data. So why would I use "body" instead of "form-data"?
|
Hmm. It's entirely possible at this point that I'm way off base here. From the looks of it :
Apparently, I'm in the wrong... at least for a bunch of it. We did fix a bug where form-encoded data wasn't built correct at all; It may have worked completely accidentally previously. To support this appropriately, we'd definitely have to support multiple streams per-request (since I'm looking into fixing it... |
Can you give me your swagger so I can see exactly what you're specifying? (either here or send it to garretts |
Hmm. Looking at the code, that fix that went in shouldn't even have affected what you were doing at all What's the |
Ah, I think this is the result of a different tangential bug fix -- In https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#fixed-fields-7 they state :
A bug got fixed where it now actually checks for the "multipart/form-data" -- your swagger has According to https://www.iana.org/assignments/media-types/media-types.xhtml -- there isn't an |
@fearthecowboy this fixed this for me. Thanks! |
I just updated AutoRest.CSharp from 2.0.0 to 2.2.45, and now it seams FileStream is broken. Let me clarify.
In my ASP.Net Core 2.0 project, in my API method, I have a parameter of type IFormFile. Swashbuckler converts this into a swagger parameter with "Parameter Type"="formData" and "Data Type"="file".
Before the update this caused AutoRest to generate code like this:
But now after the update, AutoRest generates this:
This causes a build error because "message" is of type System.IO.Stream. The build error is:
Argument 2: cannot convert from 'System.IO.Stream' to 'string'
The text was updated successfully, but these errors were encountered: