NSwagStudio v12.1.0.0 mis-generates `FileResponse` for regular response model

Created on 3 Apr 2019  路  16Comments  路  Source: RicoSuter/NSwag

@RicoSuter - NSwagStudio v12.1.0.0 mis-generates FileResponse for regular response model definition which points to a C# custom class type.

I can send you swagger.json file to reproduce the bug - ping me at [email protected]

Most helpful comment

Created a PR, please review...

All 16 comments

I have downgraded to one of previous versions I had - v12.0.7.0 and it generates response type correctly.

Maybe later versions but before v12.1.0.0 also generate response types right, I didn't check that.

v12.0.17+

Is this a duplicate of #2080 ?

I don't think so, I'm also experiencing this after fixing 2080.

We need more details, eg a part of a swagger spec for the broken operation. Pretty sure it is a problem with the consumes/produces property.

I have just sent the spec to [email protected]

We're having the same issue. The Swagger spec defines the response as "produces": ["*/*"], which causes NSwag to think it produces binary content.

In previous versions, this would be treated as json responses.

Also, "produces": ["application/json;charset=UTF-8"] makes NSwag think it returns binary content instead of json. It looks like file responses are the default/fallback now, whereas before it would default to json.

It looks like file responses are the default/fallback now, whereas before it would default to json.

Exactly, this is the regression - will check soon

Created a PR, please review...

I encountered the this issue with v13.6.1 & v13.6.2

@Thieund is that the same issue as #2892 ?

@Thieund is that the same issue as #2892 ?

No. I'm returning a file, whether with type "file" or "byte", Promise< FileResponse > is generated, but FileResponse is missing. I'm using TypeScript client, openApi 3.0.1

I have the same issue in version 13.6.2.0

@Thieund @Szymek364 : Please open new issues then. We need a sample code (hosted on github) that reproduces the issue to investigate.

Was this page helpful?
0 / 5 - 0 ratings