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

Typescript generated client does not include FileParameter when its in an Array #3354

Open
hrazmsft opened this issue Mar 10, 2021 · 2 comments

Comments

@hrazmsft
Copy link

I saw #2973 and its fixing PR #2972 . But I still has this issue.

My nswag cli is NPM/Node and the nswag version is 13.10.8:

  "devDependencies": {
    "@types/node": "^14.14.32",
    "@types/react": "^17.0.3",
    "nswag": "^13.10.8",
    "typescript": "^4.2.3"
  }

But I still facing this issue. How should I get the fix?

@martin-pinjusic
Copy link

It seems like this happens when you have only controllers that accept/return arrays of files. You can "fix" it if you create another controller action that accepts a single IFormFile as a parameter. That way the NSwag will create the FileParameter interface correctly and it will work for other things also.

I have literally added action of this signature in the code:

public async Task UploadFile(IFormFile file)
{ 
//...whatever since this is the dummy method
} 

I know it will not be acceptable for purists, but I don't care.

@hrazmsft
Copy link
Author

hrazmsft commented Mar 20, 2021

Thanks! I know that trick. But Nswag should fix it for good... :)

Also, note that in newer Nswag versions single
IFormFile (without array) is generated differently, without the interface...

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