Skip to content

Commit 09c856b

Browse files
committed
updated configuration schema
1 parent e2e6ce1 commit 09c856b

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

schemas/6.0/GitVersion.configuration.json

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@
5858
"type": "object",
5959
"properties": {
6060
"commits-before": {
61-
"$ref": "#/$defs/Nullable\u0060110"
61+
"$ref": "#/$defs/Nullable\u006019"
6262
},
6363
"sha": {
6464
"$ref": "#/$defs/array2"
6565
}
6666
}
6767
},
6868
"increment": {
69-
"$ref": "#/$defs/Nullable\u006011"
69+
"$ref": "#/$defs/IncrementStrategy"
7070
},
7171
"is-mainline": {
72-
"$ref": "#/$defs/Nullable\u006012"
72+
"$ref": "#/$defs/Nullable\u006011"
7373
},
7474
"is-release-branch": {
75-
"$ref": "#/$defs/Nullable\u006013"
75+
"$ref": "#/$defs/Nullable\u006012"
7676
},
7777
"is-source-branch-for": {
7878
"$ref": "#/$defs/array"
@@ -130,10 +130,10 @@
130130
"type": "string"
131131
},
132132
"pre-release-weight": {
133-
"$ref": "#/$defs/Nullable\u006014"
133+
"$ref": "#/$defs/Nullable\u006013"
134134
},
135135
"prevent-increment-of-merged-branch-version": {
136-
"$ref": "#/$defs/Nullable\u006015"
136+
"$ref": "#/$defs/Nullable\u006014"
137137
},
138138
"regex": {
139139
"$ref": "#/$defs/string2"
@@ -149,20 +149,24 @@
149149
"$ref": "#/$defs/array1"
150150
},
151151
"track-merge-message": {
152-
"$ref": "#/$defs/Nullable\u006016"
152+
"$ref": "#/$defs/Nullable\u006015"
153153
},
154154
"track-merge-target": {
155-
"$ref": "#/$defs/Nullable\u006017"
155+
"$ref": "#/$defs/Nullable\u006016"
156156
},
157157
"tracks-release-branches": {
158-
"$ref": "#/$defs/Nullable\u006018"
158+
"$ref": "#/$defs/Nullable\u006017"
159159
},
160160
"update-build-number": {
161161
"description": "Whether to update the build number in the project file. Defaults to true.",
162162
"type": "boolean"
163163
},
164164
"mode": {
165-
"$ref": "#/$defs/Nullable\u006019"
165+
"$ref": "#/$defs/Nullable\u006018"
166+
},
167+
"workflow": {
168+
"description": "The base template of the configuration to use. Possible values are: GitFlow/v1 or GitHubFlow/v1",
169+
"type": "string"
166170
}
167171
},
168172
"$defs": {
@@ -173,13 +177,13 @@
173177
"$ref": "#/$defs/Nullable\u00601"
174178
},
175179
"increment": {
176-
"$ref": "#/$defs/Nullable\u006011"
180+
"$ref": "#/$defs/IncrementStrategy"
177181
},
178182
"is-mainline": {
179-
"$ref": "#/$defs/Nullable\u006012"
183+
"$ref": "#/$defs/Nullable\u006011"
180184
},
181185
"is-release-branch": {
182-
"$ref": "#/$defs/Nullable\u006013"
186+
"$ref": "#/$defs/Nullable\u006012"
183187
},
184188
"is-source-branch-for": {
185189
"$ref": "#/$defs/array"
@@ -191,10 +195,10 @@
191195
"$ref": "#/$defs/string1"
192196
},
193197
"pre-release-weight": {
194-
"$ref": "#/$defs/Nullable\u006014"
198+
"$ref": "#/$defs/Nullable\u006013"
195199
},
196200
"prevent-increment-of-merged-branch-version": {
197-
"$ref": "#/$defs/Nullable\u006015"
201+
"$ref": "#/$defs/Nullable\u006014"
198202
},
199203
"regex": {
200204
"$ref": "#/$defs/string2"
@@ -203,16 +207,16 @@
203207
"$ref": "#/$defs/array1"
204208
},
205209
"track-merge-message": {
206-
"$ref": "#/$defs/Nullable\u006016"
210+
"$ref": "#/$defs/Nullable\u006015"
207211
},
208212
"track-merge-target": {
209-
"$ref": "#/$defs/Nullable\u006017"
213+
"$ref": "#/$defs/Nullable\u006016"
210214
},
211215
"tracks-release-branches": {
212-
"$ref": "#/$defs/Nullable\u006018"
216+
"$ref": "#/$defs/Nullable\u006017"
213217
},
214218
"mode": {
215-
"$ref": "#/$defs/Nullable\u006019"
219+
"$ref": "#/$defs/Nullable\u006018"
216220
}
217221
}
218222
},
@@ -224,7 +228,7 @@
224228
"MergeMessageOnly"
225229
]
226230
},
227-
"Nullable\u006011": {
231+
"IncrementStrategy": {
228232
"description": "The increment strategy for this branch. Can be \u0027Inherit\u0027, \u0027Patch\u0027, \u0027Minor\u0027, \u0027Major\u0027, \u0027None\u0027.",
229233
"enum": [
230234
"None",
@@ -234,14 +238,14 @@
234238
"Inherit"
235239
]
236240
},
237-
"Nullable\u006012": {
241+
"Nullable\u006011": {
238242
"description": "When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.",
239243
"type": [
240244
"boolean",
241245
"null"
242246
]
243247
},
244-
"Nullable\u006013": {
248+
"Nullable\u006012": {
245249
"description": "Indicates this branch config represents a release branch in GitFlow.",
246250
"type": [
247251
"boolean",
@@ -266,14 +270,14 @@
266270
"description": "The regex pattern to use to extract the number from the branch name. Defaults to \u0027[/-](?\u003Cnumber\u003E\\d\u002B)[-/]\u0027.",
267271
"type": "string"
268272
},
269-
"Nullable\u006014": {
273+
"Nullable\u006013": {
270274
"description": "Provides a way to translate the PreReleaseLabel to a number.",
271275
"type": [
272276
"integer",
273277
"null"
274278
]
275279
},
276-
"Nullable\u006015": {
280+
"Nullable\u006014": {
277281
"description": "Prevent increment of merged branch version.",
278282
"type": [
279283
"boolean",
@@ -292,28 +296,28 @@
292296
"type": "string"
293297
}
294298
},
295-
"Nullable\u006016": {
299+
"Nullable\u006015": {
296300
"description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.",
297301
"type": [
298302
"boolean",
299303
"null"
300304
]
301305
},
302-
"Nullable\u006017": {
306+
"Nullable\u006016": {
303307
"description": "Strategy which will look for tagged merge commits directly off the current branch.",
304308
"type": [
305309
"boolean",
306310
"null"
307311
]
308312
},
309-
"Nullable\u006018": {
313+
"Nullable\u006017": {
310314
"description": "Indicates this branch config represents develop in GitFlow.",
311315
"type": [
312316
"boolean",
313317
"null"
314318
]
315319
},
316-
"Nullable\u006019": {
320+
"Nullable\u006018": {
317321
"description": "The versioning mode for this branch. Can be \u0027ContinuousDelivery\u0027, \u0027ContinuousDeployment\u0027, \u0027Mainline\u0027.",
318322
"enum": [
319323
"ContinuousDelivery",
@@ -463,7 +467,7 @@
463467
},
464468
"readOnly": true
465469
},
466-
"Nullable\u0060110": {
470+
"Nullable\u006019": {
467471
"format": "date-time",
468472
"pattern": "\u0027yyyy-MM-ddTHH:mm:ss\u0027",
469473
"description": "Commits before this date will be ignored. Format: yyyy-MM-ddTHH:mm:ss.",

src/Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
3333

3434
<IsUnitTestProject>false</IsUnitTestProject>
35+
<DisableApiAnalyzers>false</DisableApiAnalyzers>
3536
<IsUnitTestProject Condition="$(MSBuildProjectName.EndsWith('.Tests')) or $(MSBuildProjectName.EndsWith('.Testing'))">true</IsUnitTestProject>
3637
</PropertyGroup>
3738

@@ -43,7 +44,7 @@
4344
<PackageReference Include="System.Text.Json"/>
4445
<PackageReference Include="System.Text.Encodings.Web"/>
4546
</ItemGroup>
46-
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'false' and $(MSBuildProjectName.EndsWith('.Schema')) == 'false'">
47+
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'false' and $(MSBuildProjectName.EndsWith('.Schema')) == 'false' and '$(DisableApiAnalyzers)' == 'false'">
4748
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers">
4849
<PrivateAssets>all</PrivateAssets>
4950
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/GitVersion.Core/Configuration/ConfigurationSerializer.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ public static class ConfigurationSerializer
1111
.WithTypeInspector(inspector => new JsonPropertyNameInspector(inspector))
1212
.Build();
1313

14-
15-
public static T Deserialize<T>(string input) => Deserializer.Deserialize<T>(input);
16-
17-
public static string Serialize(object graph) => Serializer.Serialize(graph);
18-
1914
private static ISerializer Serializer => new SerializerBuilder()
2015
.ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitNull)
2116
.WithTypeInspector(inspector => new JsonPropertyNameInspector(inspector))
2217
.WithNamingConvention(HyphenatedNamingConvention.Instance).Build();
2318

19+
public static T Deserialize<T>(string input) => Deserializer.Deserialize<T>(input);
20+
21+
public static string Serialize(object graph) => Serializer.Serialize(graph);
2422

2523
public static GitVersionConfiguration Read(TextReader reader)
2624
{

src/GitVersion.Core/Configuration/SupportedWorkflows/WorkflowManager.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal static class WorkflowManager
99
private static string DetermineResourceNameTemplate()
1010
{
1111
var fullClassName = typeof(WorkflowManager).FullName!;
12-
var resourceNamePrefix = fullClassName.Substring(0, fullClassName.Length - nameof(WorkflowManager).Length - 1);
12+
var resourceNamePrefix = fullClassName[..(fullClassName.Length - nameof(WorkflowManager).Length - 1)];
1313
return $"{resourceNamePrefix}.{{0}}.yml";
1414
}
1515

@@ -18,9 +18,7 @@ private static string DetermineResourceNameTemplate()
1818
if (string.IsNullOrEmpty(workflow)) return null;
1919

2020
var resourceName = GetResourceName(workflow);
21-
var embeddedResource = ReadEmbeddedResourceExtensions.ReadAsStringFromEmbeddedResource(
22-
resourceName, typeof(WorkflowManager).Assembly
23-
);
21+
var embeddedResource = resourceName.ReadAsStringFromEmbeddedResource(typeof(WorkflowManager).Assembly);
2422
return ConfigurationSerializer.Deserialize<Dictionary<object, object?>>(embeddedResource);
2523
}
2624

0 commit comments

Comments
 (0)