Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
412 stars 201 forks source link

Remove duplication between `RepositoryPath` and `Name` from `templates.json` #2075

Closed weikanglim closed 1 year ago

weikanglim commented 1 year ago

RepositoryPath and Name are currently duplicated in template metadata, see here. Original comment here.

We should reduce the contract surface area.

Early Proposal

Remove RepositoryPath in favor of Name. Templates should have names. We can describe name simply as follows:

A template name is a fully qualified URI to a github repository, "{org}/{repo}" for GitHub repositories, or "{repo}" for GitHub repositories under Azure-Samples (default organization).

Alternative naming: Use Id and Title similar to how NuGet schema.

Final Proposal

vhvb1989 commented 1 year ago

See this: https://github.com/Azure/azure-dev/pull/90

We used to have an issue some time ago where the Name was used to fetch the repo-path (as a result of using the Name for the Selection and loosing the path after selecting from the list).

This issue should be fixed now and Name and Path are still there with the same value,,, but the name can be updated to whatever we want to be the display name without affecting the path.

So, if you want, you can rename name to Display name to make it a better name :)

But I don't think we need name and displayName

weikanglim commented 1 year ago

Packages, templates, artifacts should have names or IDs. Having "RepositoryPath" being the primary identifier disrupts the mental model for me. But perhaps we don't need one?

vhvb1989 commented 1 year ago

it should not be the primary id. the id should be the name , which can be the displayName as well. Unless there is a requirement for having both. The way I would have it is:

The name is the key and the path is a required attribute. Description can be used to created documentation or longer help notes about the template. Order can be used to promote the template above others easily.

I would also move the template list outside of the azd binary to be pulled from git repo, so it can be changed on demand

weikanglim commented 1 year ago

I do see the similarities between the proposed design and go modules, and it's worked out well there.

I would also move the template list outside of the azd binary to be pulled from git repo, so it can be changed on demand

This is definitely on our plate, but we probably want to have proper feature design around there. This goes into indexing etc etc.