Skip to content
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

FileResponse does not generate required Produces value in swagger.json #460

Closed
izzycoding opened this issue Aug 10, 2017 · 2 comments
Closed

Comments

@izzycoding
Copy link

I have an API action that returns a PhysicalFileResponse. But no matter what I do I cannot get the output swagger.json to contain the correct definition.

As I understand it there should be a type of "file" and something to do with "byte" in there, but all I get is:
...consumes:[],produces[],...

This means when I try to generate a Client using NSwag it creates code that either returns nothing (or if I use [Produces(typeof(PhysicalFileResponse))] then it does not handle the response as a file.

Am I doing something wrong or is this a missing feature?

@domaindrivendev domaindrivendev added this to the v3.0.0 milestone Jun 8, 2018
@domaindrivendev
Copy link
Owner

In this scenario, it's difficult for Swashbuckle to do the right thing because ASP.NET Core's built-in metatdata provider - ApiExplorer doesn't provide enough information.

The good news is that someone has already posted an issue to the Mvc repo for this. It's well worth a read because the thread includes a decent workaround that you can use:

aspnet/Mvc#5701.

It sounds like there might be changes to ApiEXplorer coming soon that will help but until then, I'm going to move this issue to the backlog.

@domaindrivendev domaindrivendev modified the milestones: v3.0.0, Backlog Jun 15, 2018
@domaindrivendev
Copy link
Owner

See #1034 for a working approach to describing operations that return a file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants