-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support other language output #392
Comments
First of all, thank you for taking the time to suggest this! I can easily add this for the CLI Tool but I don't know if it makes sense the Visual Studio addon. I haven't heard of anyone who uses Visual Studio as an IDE for TypeScript. I thought most (if not all) web developers moved to Visual Studio Code. The tooling for generating code behind files is a really old API and last time I checked it only supported C# and VB.NET. I can though just use the code generator to generate files on the file system and hopefully Visual Studio will pickup the changes. Anyway, I'll look into this and see what I can do. |
Visual Studio Pro is an extremely strong IDE for TypeScript. Most developers I know that have used and learned how to fully utilize Visual Studio, would not touch VS Code with a 10' pole! VS is so much more powerful of an IDE than VS Code. It's why one is free and the other is not. I'm not really sure I follow with what you are referring to with generating code behind files. VS does not "generate code" behind files for cs or vb files, as they are already... code. I think you may be thinking of windows UI development, where VS will generate the code for WinForms. Also, the new VS 2022 utilizes language engines much like VS Code. When we use VS to develop web projects, we usually utilize Node and npm manager along with task runner. We are not creating node packages in VS, we write all our site's JS in TS and compile it down to JS to be referenced on our site. So, we utilize the open api generator to create our client api TS for us in our existing web/vue project. Also, I think you missed the bigger picture that was being requested. There are several different types of languages that the code generator supports producing. The request was to allow to choose the generator. |
So I just tried to do a create new typescript react project in Visual Studio. I have no idea what I'm doing but I wanted to see what Visual Studio generates. I think I can implement a context menu on the solution explorer for a .json (or .yml) file, and also a .nswag file that will launch the code generator CLI tool with a certain set of command-line arguments. I know that OpenAPI Generator and NSwag supports generating TypeScript clients as my colleagues who do web apps use them. As for the "code behind" files, well this is basically the output of a Visual Studio Custom Tool which that can be configured to a .NET project item (like .cs or .vb) that executes upon any changes to the contents of the project item. This API has been around for ages and depends on very old COM libraries. The core feature of this Visual Studio extension is basically adding some context menu helpers to be able to use a code generator that is launched from a VS Custom Tool upon making changes to the selected file. I think I understand what you are requesting. This is how I understand it: Instead of generating a code-behind file like in .NET projects, I will build something that just executes the code generator to produce files with the selected directory. I know that with NSwag Studio you can configure relative paths so if we for example have a .nswag file in the Visual Studio project, I can build context menus for the given file which allows you to select which code generator to use and will just execute the code generator. Visual Studio should pickup changes in the file system and refresh the solution explorer. |
I started working on this recently. I started with my CLI tool as its easier to test things using on multiple platforms and OS versions If you haven't already tried, you install this as a dotnet tool via
Here's a usage example:
So far this only specifies which tech stack to use when generating code using OpenAPI Generator. If you have any specific usages then I would love to include them in this tool I'll try to start working on the Visual Studio extension in the coming week, if work or family doesn't get too much in the way :D |
Why add a separate generator class and not change it so the |
That was my original design until I noticed that the parameters for each generator are quite different from each other. Even the TypeScript generators. I'm aiming to expose the config options for each supported generator to have a UI in the Visual Studio settings screen. I have this command: Thanks again for your time and suggestions |
I'll keep this open until I finish implementing the solution explorer context menus for generating TypeScript |
Example, OpenAPI Generator supports creating clients in TypeScript, allow choosing what client language to generate.
The text was updated successfully, but these errors were encountered: