dotnet / templating

This repo contains the Template Engine which is used by dotnet new
https://docs.microsoft.com/dotnet/
MIT License
1.59k stars 363 forks source link

Authoring tools: templates & template packages validation #2623

Open vlada-shubina opened 3 years ago

vlada-shubina commented 3 years ago

As a template author, I want a way to validate the templates, so that I can validate template before the publish. Audience: template authors

Background

The template configuration requires manual editing in of JSON configuration which is source of authoring mistakes. The configuration involves a lot of conditions, which are not validated in any way until the template is being generated. When grouping the templates the configuration is manually, and requires careful combination of the fields across multiple JSON files. The grouping errors are shown only when the template is being run (not when the package containing it is installed)

Planned validation checks:

(note: though some of the issues are closed, their comments contain suggested validation check)

Justification

Technical details

We plan to expose 2 ways:

As part of this task, the validation in template engine and dotnet new should be improved as well.

Feedback from @sayedihashimi

KathleenDollard commented 3 years ago

How does this fit in with @sayedihashimi 's tool?

KathleenDollard commented 3 years ago

One of the things we should validate for is the use of parens around complex conditions as discussed in #2209

sayedihashimi commented 3 years ago

How does this fit in with @sayedihashimi 's tool?

I think the idea is to have some similar validation, but it's built into dotnet new instead of a stand alone tool.

The tool should accept multiple values for folder path/path to .nupkg

This is good, but in addition to this I think that when a folder path is specified, the tool should search the folder recursively for all templates. If a user is authoring a template pack (i.e. AWS/Uno/etc) they can pass the root folder to the validator and then it will discover all the templates that the folder contains.

jzabroski commented 3 years ago

I am cool with your thought process, @KathleenDollard . Seems worth the story points vs the other discussion.

vlada-shubina commented 1 year ago

The following was already done:

The following tasks remain: