TL;DR:
Is "license": "MIT" in config enough to be a valid license in a software project?
- Maybe, so consider the answer no.
If a project does not have a valid enough license, what should I do?
- It is probably not the highest priority, but consider prompting them to include a valid LICENSE file.
From the answers and comments kindly received here and research done myself, I have decided it is important to answer this myself.
Due to law being more vague than software, there seems to be disparity between what the law wants and what tools/services want.
Looking at the documentation for npm package.json license, it does seem programmatically that the "license" field does provide enough information to know the type of license used:
However, as both @BartvanIngenSchenau and @nemo have kindly explained, the MIT license expects the year and copyright holder. Therefore, it is expected that a license is provided that includes this information too. Given that the intention is quite clear even without these parameters for at least the MIT license, it may be implied that this would be enough, and may be so. However, this is clearly prone to being technically invalid, and is also an unnecessary risk, so is not advisable.
Considering this, how should the license with the correct parameters be stored and linked to? For npm, there is the following example: { "license": "SEE LICENSE IN " } This seems to be the only current way to link explicitly to a file. However, this means that an SPDX identifier can not be used here. The deprecated license and licenses object formats did include a "type" and "url" field, making this possible. However, for some reason this has become deprecated. Looking at the documentation for "files" shown below, it shows that LICENSE is a known file type, so linking to this license should be possible by just using this name.
Therefore, it can be inferred that the correct way to handle this in npm is:
- Use an SPDX identifier for "license".
- Include the license with parameters in the LICENSE file.
This does mean that a license file needs to be made for each project, instead of just using the license type or linking to a common license. Creating a common license and copying that into the project each time either manually or automatically seems to be the best solution.
This solves the license being programmatically available and linked properly issue. It is also important that people reading the page can see the license. For a repository, the top files are shown by default, so if using the standard LICENSE file format, it could be considered enough. The repository service might also show the license as a link by default for LICENSE files. If there is no license link, or just in case, a link to the license file should be added.
This comes to the main reason for asking the question. What should I do if a repository/package does not meet these expectations? It is very common for repositories to just have a license field and nothing more. This is why I asked the question in the first place. It doesn't seem to be a high risk to use these dependencies, especially if it is easy to replace them with something else if necessary, but it does seem to be something worth prompting repository owners to fix. At least a proper license file would be enough to make the license file valid and clear.