Json: Git tags are not valid semvers

Created on 29 Sep 2020  ·  6Comments  ·  Source: nlohmann/json

Impossible to use conan version ranges because the git tags are not valid semver because of the 'v' prefix.
See https://docs.conan.io/en/latest/versioning/version_ranges.html.

Steps to reproduce:

  1. Specify "nlohmann_json/[~=v3.9]@clickshare/stable" in
  2. Error upon build is:
    ERROR: Version range '~=v3.9' from requirement 'nlohmann_json/[~=v3.9]@project/stable' required by '...' could not be resolved in local cache
invalid

Most helpful comment

Looking at https://semver.org/ I find

No, “v1.2.3” is not a semantic version. However, prefixing a semantic version with a “v” is a common way (in English) to indicate it is a version number. Abbreviating “version” as “v” is often seen with version control. Example: git tag v1.2.3 -m "Release version 1.2.3", in which case “v1.2.3” is a tag name and the semantic version is “1.2.3”.

so IMHO it is conan's job to support v prefixes.

All 6 comments

It seems the documentation is not up-to-date as it says use nlohmann_json. I found in an earlier bug report to use jsonformoderncpp from vthiery. Anyway that works for me but the latest version is 3.7.3.

The Page you linked do not mention git tags. This page (https://git-scm.com/book/en/v2/Git-Basics-Tagging) describes that adding a v-prefix is common practice. I am not sure why this is a problem with Conan.

You're right, it's mainly git tagging which is not compatible with semver. Looks like only the v is the problem 🙄.

I don't really see a problem.

Looking at https://semver.org/ I find

No, “v1.2.3” is not a semantic version. However, prefixing a semantic version with a “v” is a common way (in English) to indicate it is a version number. Abbreviating “version” as “v” is often seen with version control. Example: git tag v1.2.3 -m "Release version 1.2.3", in which case “v1.2.3” is a tag name and the semantic version is “1.2.3”.

so IMHO it is conan's job to support v prefixes.

Closing this issue as it is not related to this library.

Was this page helpful?
0 / 5 - 0 ratings