From 97f6430fd4cbef3293428133298edfd56e63bc36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 14:32:57 +0000 Subject: [PATCH 1/2] Initial plan From 14c261100aa1b76cbbe1ce901e6f4aa246382045 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 14:40:27 +0000 Subject: [PATCH 2/2] Update version schema to allow uppercase letters in pre-release identifiers Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com> --- .../version.schema.json | 6 ++--- .../VersionSchemaTests.cs | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/NerdBank.GitVersioning/version.schema.json b/src/NerdBank.GitVersioning/version.schema.json index c8f63429e..814eb5214 100644 --- a/src/NerdBank.GitVersioning/version.schema.json +++ b/src/NerdBank.GitVersioning/version.schema.json @@ -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", @@ -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", @@ -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": { diff --git a/test/Nerdbank.GitVersioning.Tests/VersionSchemaTests.cs b/test/Nerdbank.GitVersioning.Tests/VersionSchemaTests.cs index 0c8ca0679..b09cb7d8c 100644 --- a/test/Nerdbank.GitVersioning.Tests/VersionSchemaTests.cs +++ b/test/Nerdbank.GitVersioning.Tests/VersionSchemaTests.cs @@ -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)); + } }