Closed Tyrrrz closed 4 years ago
@Tyrrrz what kinds of validation do you have in mind exactly? It might be sufficient to include a .targets
file to perform the validation at build time instead?
Hi @thorhj The validations that I think will be useful are:
AddCommandsFromThisAssembly
These are just off top of my head
Is it possible/sensible to add an analyzer to the consumer project when adding this NuGet package? I am not experienced with analyzers, but the above validations could easily be checked by a .targets
files, albeit at build time.
I haven't made an analyzer myself yet :) From my experience using open API analyzers for ASP.NET Core, it's just a NuGet package you add to the consumer project. Analyzers can both point out issues as well as quick fixes.
I'm not sure how to make validations like that with .targets
files, do you have an example?
I must have misremembered, it does not seem to be easily doable as an MSBuild task. Microsoft.NET.Sdk.Functions
has a task that (among other things) check validate uniqueness of Function names, but that is done by a separate console application.
Yeah, so it seems it has to be done through the analyzer API.
Generally, I would like all validation that happens in CommandSchemaResolver
to happen at build time. That would make the feedback loop shorter and improve user experience.
It's happening:
Add analyzers as part of a nuget package to validate attribute usage at the time the code is written.