hex icon indicating copy to clipboard operation
hex copied to clipboard

mix hex.build: Revisit basic metadata validations

Open wojtekmach opened this issue 4 years ago • 4 comments

A brand new Mix project would trigger these warnings when executing mix hex.build:

** (Mix) Stopping package build due to errors.
Missing metadata fields: description, licenses, links

It is very easy to make the build pass by giving these "zero" values:

package: [
  licenses: [],
  links: %{},
  description: ""
]

which makes me think, should we either:

  1. add basic validations, licenses/links are non-empty lists, description is non-empty string
  2. make the "zero" values the defaults
  3. like 2, except empty licenses trigger a warning (https://github.com/hexpm/hex/pull/915/files#diff-06919f8ea819ec0528faa886d5f8ef7ff61d8564b9743a41d37636e286906c1bR199)

I think option 3 is the most appropriate. Thoughts?

wojtekmach avatar Oct 12 '21 08:10 wojtekmach

I like they way it works currently because it pushes you in the direction of filling in the information but if you don't really want to you can add the empty values.

ericmj avatar Oct 13 '21 12:10 ericmj

I think the links section is fine if empty, but we are warning (and soon will be raising for new packages) on missing licenses. The description does seem like something we'd want to pressure users into including. (none of this applies to private orgs.)

If we do validate the description more deeply, how? ie. If I just add 1 character, is that enough? why or why not? Warning (vs raising) might not prevent people that really want to leave it empty, but I think takes what we do now (making sure the key exists) to the next logical level.

supersimple avatar Nov 15 '21 20:11 supersimple

Should we have different validation depending on if you are publishing to an organization or a public package? How would that work for mix hex.build? Maybe we should move validation out of the build step and into the publish step by parsing the already built package in mix hex.publish?

ericmj avatar Nov 16 '21 20:11 ericmj

Hi, I stumbled upon this issue when trying to build a package locally. The documentation for hex.build (https://hexdocs.pm/hex/Mix.Tasks.Hex.Build.html) suggests that the description, links and license are not required. The docs could be updated to reflect the fact that some values (even if empty) have to be provided for these keys.

gustawlippa avatar Aug 17 '22 11:08 gustawlippa