Open Kokujou opened 4 years ago
Maybe you're looking for this? https://github.com/Jusas/NSwag.AzureFunctionsV2
No, probably not. i tested it out and this lead me to my problems i described here. also i'm not even sure if this package is even targetting the generation of clients. Maybe it's just swagger UI it's talking about. but i want an typescript and a c# client for my function app.
It's not straightforward for NSwag to generate an OpenAPI definition for Azure Function projects, because it differs too much from the ASP.net core way of doing. This is why NSwag.AzureFuction exists, it should be able to generate an OpenAPI definition for your project, that you can later pass to NSwag to generate your client.
Another option would be to write your own OpenApi definition by hand, and use the new Microsoft tools that generates Azure functions projects from the definition.
well that i already noticed ^^ but i mean... we managed to get a swagger UI already. we just can't manage to compile the client project. if there'd be an even more basic nswag client generation tool which just excepts some kind of open api file which is probably generated somewhere alrady and only create a client using that it'd be nice but... well^^
is anyone here able to point me to something which helps? or is it just impossible?
I think you are confused between the OpenAPI specification file (sometimes called swagger.json), which describes your API, and swaggerUI, which uses the former file to show a UI where you can try your API. By downloading the OpenApi definition (a link for that should be present in the SwaggerUI interface), you can use NSwag to generate client files from that swagger.json.
I'm under the impression that you're trying to generate your client from the project directly, which doesn't work at the moment, only asp.net core projects are supported.
that's true. actually i want to do it during my build process. so, okay, can you then probably tell me how to generate a client using a json file?
Hello~ I tried now a lot of times to generate an nswag client for typescript and c# for an azure function app. it is possible to generate a swagger documentation for function apps so it also should be possible to generate an nswag client right? sadly... it's not. there are like a very lot of problems and i will describe them now:
The output format differs. My function app has the structure bin/Debug/netcoreapp3.1/bin , but i could solve this with just copying the output into the netcoreapp3.1 folder where it's expected
there is not runtimeconfig generated, so i finally found out that you can solve this with addying (in the honest hope that code quotes are working like that)
after all that trouble the last error is now terminating: