csharpfritz / InstantAPIs

A library that generates Minimal API endpoints for an Entity Framework context.
MIT License
448 stars 57 forks source link

feat: Add configuration of Generators to the Test and WorkingApi Projects #45

Closed Stelzi79 closed 2 years ago

Stelzi79 commented 2 years ago

This add some configuration of Generators to Test.csproj and WorkingApi.csproj in order to be able to check in the generated files into Git. It enables to review changes to the Generators in future better in PRs.

csharpfritz commented 2 years ago

Cool idea! Tagging @jasonbock to review

JasonBock commented 2 years ago

I'm personally not a fan of persisting the generated files and then putting them into Git. Just not my thing.

Stelzi79 commented 2 years ago

In any project this library gets consumed I would concur that generated files generally don't have a place in Git BUT this project is about coding the generator.

For any decent sized project or open source like this you need a way to see with every PR if or what actually the changes to the generator changed to the generated files for review purposes. If these changes are easy to see in the diff unwanted (potential malicious) changes are seen at a first glance.

Another thing would be that with the generated output you can make fairly quick and cheap unit tests in a more end to end fashion. For example you always could "save away" the generated output into a folder in a test project and use them further.

JasonBock commented 2 years ago

I already have a test project in place to verify that the generated code is what is expected. Furthermore, the tests use the source generator testing libraries in NuGet to ensure they also compile.

csharpfritz commented 2 years ago

Closing in favor of the unit tests @JasonBock has built for the Source Generators.

Thanks for the idea!