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

Preview of generated output #51

Open
hardtourvela opened this issue Aug 7, 2019 · 1 comment
Open

Preview of generated output #51

hardtourvela opened this issue Aug 7, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@hardtourvela
Copy link

hardtourvela commented Aug 7, 2019

Hi
First of all thanks a lot for this tool, it has really saved me a lot of time!. I have the following use case. I would like to have a little bit more control over specific Swagger files, as an example, i have a specification in which i require to generate only 1 out of 3 DTO's this is because most of my DTOs exist within the same solution already. So i was thinking, (I haven't read your code so I'm just assuming) at the time you first read the swagger file you already know what you're going to create, so maybe show a little "Preview Window" in which you are able to check/uncheck what's about to be generated.
BTW do you have any contribution guidelines? I was thinking maybe i can help with this
Thanks!

@christianhelle
Copy link
Owner

Hi!

Thank you for your kind words! I'm glad you find it useful

Regarding having control over Swaagger files, you should consider generating code using NSwag Studio. I have a "right click" based solution for generating a NSwag Studio configuration file and you can customise that file quite extensively, by hand or by using NSwag Studio.

I haven't tried your exact use case but in our case we have a frontend-to-backend gateway used by our frontend applications to interact with our microservices. This gateway will call several microservices using several code generated swagger clients. We use NSwag Studio to use an existing Exception class instead of generating multiple copies of exactly the same class, split by namespace. We always generate our DTO's because this is the contract between the gateway and the microservices, but we write the contracts returned by the gateway endpoints by hand as these describes the resources exposed by the frontend-to-backend gateway and not what the microservices return, even though there are a few scenarios where they are exactly the same

Anyway, implementing a "Preview Window" sounds like a great idea but currently I rely on the IVsSingleFileGenerator interface to implement the Custom Tool and this interface doesn't offer any previewing infrastructure, but we could implement this interface in a way that before we return the generated code to Visual Studio we can show a preview window with an OK/Cancel button and give the user a chance to modify the output by hand. This interface is a UI blocking one that is unfortunately some legacy thing in Visual Studio so the experience might be a bit ugly. We can also create some option pages so we can enable/disable the Preview Window

All in all, I really like this idea! I have no contribution guidelines as I honestly didn't expect to have the number of users I have now. You are more than welcome to come with any contributions and lets take all discussions at the pull request level

Thanks again!

@christianhelle christianhelle added the enhancement New feature or request label Aug 7, 2019
@christianhelle christianhelle self-assigned this Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants