Originally created by @damianpowell on GitHub (Feb 13, 2014).
I can read this two ways:
A pre-release identifier which consists entirely of decimal digits, MUST begin with a digit other than zero, or it MUST be the single digit zero, or,
A pre-release identifier which consists entirely of decimal digits, but begins with a zero, MUST be considered to be alphanumeric.
The distinction is important because it changes how we validate a SemVer string. Under the first approach, we would consider 1.2.3-alpha.012.2 to be invalid, but under the second approach, we would not. However, the sorting applied in approach 2 would consider the second identifier "012" to be an alphanumeric string.
Which is the correct approach, please?
Originally created by @damianpowell on GitHub (Feb 13, 2014).
I can read this two ways:
1. A pre-release identifier which consists entirely of decimal digits, MUST begin with a digit other than zero, or it MUST be the single digit zero, or,
2. A pre-release identifier which consists entirely of decimal digits, but begins with a zero, MUST be considered to be alphanumeric.
The distinction is important because it changes how we validate a SemVer string. Under the first approach, we would consider 1.2.3-alpha.012.2 to be invalid, but under the second approach, we would not. However, the sorting applied in approach 2 would consider the second identifier "012" to be an alphanumeric string.
Which is the correct approach, please?
Hence, 012 cannot be considered as an alphanumeric identifier.
@zafarkhaja commented on GitHub (Feb 13, 2014):
As per the BNF grammar, alphanumeric identifiers must contain at least one non-digit character
```
<alphanumeric identifier> ::= <non-digit>
| <non-digit> <identifier characters>
| <identifier characters> <non-digit>
| <identifier characters> <non-digit> <identifier characters>
```
Hence, `012` cannot be considered as an alphanumeric identifier.
Thanks, @zafarkhaja. The BNF is useful but it's not published on SemVer.org yet so I must assume it's either not finished or intended for a later release of the SemVer specification.
@damianpowell commented on GitHub (Feb 13, 2014):
Thanks, @zafarkhaja. The BNF is useful but it's not published on SemVer.org yet so I must assume it's either not finished or intended for a later release of the SemVer specification.
It's probably time to update semver.org. But we might want to clarify the text so it's clearer too. Mind submitting PRs?
@haacked commented on GitHub (Feb 13, 2014):
It's probably time to update semver.org. But we might want to clarify the text so it's clearer too. Mind submitting PRs?
[...] Numeric identifiers MUST NOT include leading zeroes. [...]
[...] identifiers consisting of only digits are compared numerically and identifiers with letters or hyphens are compared lexically in ASCII sort order. [...]
Following the points 9. and 11., the spec seems to indicate that only identifiers with a letter or a hyphen are considered alphanumeric identifiers, leaving numeric identifiers to consist only of numbers. Since 9. prohibits usage of leading zeroes, they are not valid numeric identifiers, thus declaring 1.0.1-alpha.012 not to be a semantic version.
Case closed, I suppose.
@FichteFoll commented on GitHub (Nov 3, 2015):
Revisiting this again.
> 9) [...] Numeric identifiers MUST NOT include leading zeroes. [...]
> 11) [...] identifiers consisting of only digits are compared numerically and identifiers with letters or hyphens are compared lexically in ASCII sort order. [...]
Following the points 9. and 11., the spec seems to indicate that only identifiers with a letter or a hyphen are considered alphanumeric identifiers, leaving numeric identifiers to consist only of numbers. Since 9. prohibits usage of leading zeroes, they are not valid numeric identifiers, thus declaring `1.0.1-alpha.012` not to be a semantic version.
Case closed, I suppose.
@damianpowell, if you have no further questions regarding this issue, please close it at your earliest possible convenience.
@jwdonahue commented on GitHub (Dec 5, 2017):
@damianpowell, if you have no further questions regarding this issue, please close it at your earliest possible convenience.
Rule 9 should probably explicitly state that a numeric identifier is an identifier which consists of only digits, similar to how rule 10 is explicit about it, since rule 9 comes first.
@purplexa commented on GitHub (Apr 16, 2018):
Rule 9 should probably explicitly state that a numeric identifier is an identifier which consists of only digits, similar to how rule 10 is explicit about it, since rule 9 comes first.
@damianpowell, unless you intend to issue a PR or have further questions, please close this issue at your earliest possible convenience.
Thank you.
@jwdonahue commented on GitHub (Jan 17, 2020):
@damianpowell, unless you intend to issue a PR or have further questions, please close this issue at your earliest possible convenience.
Thank you.
@alexandrtovmach commented on GitHub (Jun 10, 2020):
This issue looks staled and will be closed in 10 days if there are no objections. Thanks everyone for contributions, you're amazing 🎆
@alexandrtovmach commented on GitHub (Jun 10, 2020):
This issue looks staled and will be closed in 10 days if there are no objections. Thanks everyone for contributions, you're amazing :fireworks:
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @damianpowell on GitHub (Feb 13, 2014).
I can read this two ways:
The distinction is important because it changes how we validate a SemVer string. Under the first approach, we would consider 1.2.3-alpha.012.2 to be invalid, but under the second approach, we would not. However, the sorting applied in approach 2 would consider the second identifier "012" to be an alphanumeric string.
Which is the correct approach, please?
@zafarkhaja commented on GitHub (Feb 13, 2014):
As per the BNF grammar, alphanumeric identifiers must contain at least one non-digit character
Hence,
012cannot be considered as an alphanumeric identifier.@damianpowell commented on GitHub (Feb 13, 2014):
Thanks, @zafarkhaja. The BNF is useful but it's not published on SemVer.org yet so I must assume it's either not finished or intended for a later release of the SemVer specification.
@haacked commented on GitHub (Feb 13, 2014):
It's probably time to update semver.org. But we might want to clarify the text so it's clearer too. Mind submitting PRs?
@tbull commented on GitHub (Feb 14, 2014):
The BNF is a derived work from the spec and (at this time) not normative
by itself.
@FichteFoll commented on GitHub (Aug 28, 2015):
push
This is still an issue with the spec as it's unclear in this regard.
@mkllnk commented on GitHub (Oct 24, 2015):
Just got confused about this as well. You could include a negative example to clarify this.
@FichteFoll commented on GitHub (Nov 3, 2015):
Revisiting this again.
Following the points 9. and 11., the spec seems to indicate that only identifiers with a letter or a hyphen are considered alphanumeric identifiers, leaving numeric identifiers to consist only of numbers. Since 9. prohibits usage of leading zeroes, they are not valid numeric identifiers, thus declaring
1.0.1-alpha.012not to be a semantic version.Case closed, I suppose.
@jwdonahue commented on GitHub (Dec 5, 2017):
@damianpowell, if you have no further questions regarding this issue, please close it at your earliest possible convenience.
@purplexa commented on GitHub (Apr 16, 2018):
Rule 9 should probably explicitly state that a numeric identifier is an identifier which consists of only digits, similar to how rule 10 is explicit about it, since rule 9 comes first.
@jwdonahue commented on GitHub (Jan 17, 2020):
@damianpowell, unless you intend to issue a PR or have further questions, please close this issue at your earliest possible convenience.
Thank you.
@alexandrtovmach commented on GitHub (Jun 10, 2020):
This issue looks staled and will be closed in 10 days if there are no objections. Thanks everyone for contributions, you're amazing 🎆
@alexandrtovmach commented on GitHub (Jun 19, 2020):
👻 👻 👻
Closed as staled