-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Issue with IFormFile and IFormFileCollection using AddOpenApiDocument() #2259
Comments
We are facing a similar issue, but here FileParameter is generated when we use IFormFile in C#. What is FileParameter? it is no existing class anywhere... |
On the controller side, you declare a Stream or a IFormFile parameter (Stream + file name). The Stream class doesn't serialize correctly into json, so you can't use it on the client side, so NSwag generates a FileParameter class. |
@jeremyVignelles The IFormFile is also generated as a FileParameter class... Which is nowhere to be found, not on any page on the internet. What is this class, why is it generated, and why can it not be found? |
If you can't serialize a Stream, you can't serialize something that contains a stream (IFormFile), so FileParameter is generated on your C# client file. IFormFile -> FileParameter is the expected behavior, IFormFile -> string isn't. @skolmer : Can you post a repro project somewhere? I've never seen such issue. |
@jeremyVignelles That didnt quite answer my question: "What is this class, why is it generated, and why can it not be found?" FileParameter does not exist anywhere... |
I mean that the class is in your C# generated code (if you are using the C# generator). It can't really be defined as such because:
As for the why it is being generated, I think I answered the question properly, but let me correct something. IFormFile is not serialized as JSON. That still stands:
Why can't you find it anywhere? because of the usual issue with many projects : documentation. Now, please stop polluting the issue with your questions. Either come and chat on gitter, or open your own question. This discussion is unrelated to the initial topic. |
This is still a problem... The overall support for OpenAPI 3 is poor it seems. |
Thanks for this great project!
Unfortunately I have some issues with the Open API document generator in ASP.NET Core.
If I use
AddOpenApiDocument
instead ofAddSwaggerDocument
, allIFormFile
andIFormFileCollection
parameters are exported asstring
orICollection<string>
.If I switch to
AddSwaggerDocument
the generated document has the parameter typefile
and the generated client code usesFileParameter
instead ofstring
, which is the expected behavior.Is this a limitation in the OpenAPI Spec or the implementation or did I miss some configuration detail?
thanks in advance.
The text was updated successfully, but these errors were encountered: