Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/NerdBank.GitVersioning/version.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"version": {
"type": "string",
"description": "The major.minor-pre version to use as the basis for version calculations. If {height} is not used in this value and the value has fewer than the full major.minor.build.revision specified, \".{height}\" will be appended by the build.",
"pattern": "^v?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*))?)?(-(?:[\\da-z\\-]+|\\{height\\})(?:\\.(?:[\\da-z\\-]+|\\{height\\}))*)?(\\+(?:[\\da-z\\-]+|\\{height\\})(?:\\.(?:[\\da-z\\-]+|\\{height\\}))*)?$"
"pattern": "^v?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*))?)?(-(?:[\\da-zA-Z\\-]+|\\{height\\})(?:\\.(?:[\\da-zA-Z\\-]+|\\{height\\}))*)?(\\+(?:[\\da-zA-Z\\-]+|\\{height\\})(?:\\.(?:[\\da-zA-Z\\-]+|\\{height\\}))*)?$"
},
"inherit": {
"type": "boolean",
Expand Down Expand Up @@ -71,7 +71,7 @@
"versionHeightOffsetAppliesTo": {
"type": "string",
"description": "The version to which the versionHeightOffset applies. When the version property changes such that the version height would be reset, and this property does not match the new version, the versionHeightOffset will be ignored. This allows the offset to implicitly reset as intended without having to manually remove it from all version.json files.",
"pattern": "^v?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*))?)?(-(?:[\\da-z\\-]+|\\{height\\})(?:\\.(?:[\\da-z\\-]+|\\{height\\}))*)?(\\+(?:[\\da-z\\-]+|\\{height\\})(?:\\.(?:[\\da-z\\-]+|\\{height\\}))*)?$"
"pattern": "^v?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*)(?:\\.(0|[1-9][0-9]*))?)?(-(?:[\\da-zA-Z\\-]+|\\{height\\})(?:\\.(?:[\\da-zA-Z\\-]+|\\{height\\}))*)?(\\+(?:[\\da-zA-Z\\-]+|\\{height\\})(?:\\.(?:[\\da-zA-Z\\-]+|\\{height\\}))*)?$"
},
"buildNumberOffset": {
"type": "integer",
Expand All @@ -94,7 +94,7 @@
"gitCommitIdPrefix": {
"type": "string",
"description": "The git commit prefix (e.g. 'g') in non-public release versions.",
"pattern": "^[^0-9][\\da-z\\-_\\.]*$",
"pattern": "^[^0-9][\\da-zA-Z\\-_\\.]*$",
"default": "g"
},
"gitCommitIdShortAutoMinimum": {
Expand Down
24 changes: 24 additions & 0 deletions test/Nerdbank.GitVersioning.Tests/VersionSchemaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,28 @@ public void ReleaseProperty_InvalidJson(string json)
this.json = JObject.Parse(json);
Assert.False(this.json.IsValid(this.schema));
}

[Fact]
public void VersionField_SupportsUppercaseLettersInPreRelease()
{
// Test uppercase letters in pre-release identifiers
this.json = JObject.Parse(@"{ ""version"": ""2.3-BETA"" }");
Assert.True(this.json.IsValid(this.schema));
this.json = JObject.Parse(@"{ ""version"": ""2.3-Beta"" }");
Assert.True(this.json.IsValid(this.schema));
this.json = JObject.Parse(@"{ ""version"": ""2.3-RC"" }");
Assert.True(this.json.IsValid(this.schema));
this.json = JObject.Parse(@"{ ""version"": ""2.3-Alpha.1"" }");
Assert.True(this.json.IsValid(this.schema));
this.json = JObject.Parse(@"{ ""version"": ""2.3-BETA-Final"" }");
Assert.True(this.json.IsValid(this.schema));
this.json = JObject.Parse(@"{ ""version"": ""1.2.3-RC1"" }");
Assert.True(this.json.IsValid(this.schema));

// Test uppercase in build metadata
this.json = JObject.Parse(@"{ ""version"": ""2.3+BUILD"" }");
Assert.True(this.json.IsValid(this.schema));
this.json = JObject.Parse(@"{ ""version"": ""2.3-beta+BUILD.123"" }");
Assert.True(this.json.IsValid(this.schema));
}
}