Skip to content

Commit e88f431

Browse files
committed
remove System.Text.Json from GitVersion.Core
1 parent dacd364 commit e88f431

33 files changed

+129
-94
lines changed

schemas/6.0/GitVersion.configuration.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,8 @@
126126
"pre-release-weight": {
127127
"$ref": "#/$defs/nullableOfInt32"
128128
},
129-
"prevent-increment-of-merged-branch-version": {
130-
"$ref": "#/$defs/nullableOfBoolean2"
131-
},
132-
"prevent-increment-when-current-commit-tagged": {
133-
"$ref": "#/$defs/nullableOfBoolean3"
129+
"prevent-increment": {
130+
"$ref": "#/$defs/preventIncrementConfiguration"
134131
},
135132
"regex": {
136133
"$ref": "#/$defs/string2"
@@ -186,6 +183,7 @@
186183
"description": "Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfiguredNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'TrunkBased'.",
187184
"enum": [
188185
"None",
186+
"Fallback",
189187
"ConfiguredNextVersion",
190188
"MergeMessage",
191189
"TaggedCommit",
@@ -231,11 +229,8 @@
231229
"pre-release-weight": {
232230
"$ref": "#/$defs/nullableOfInt32"
233231
},
234-
"prevent-increment-of-merged-branch-version": {
235-
"$ref": "#/$defs/nullableOfBoolean2"
236-
},
237-
"prevent-increment-when-current-commit-tagged": {
238-
"$ref": "#/$defs/nullableOfBoolean3"
232+
"prevent-increment": {
233+
"$ref": "#/$defs/preventIncrementConfiguration"
239234
},
240235
"regex": {
241236
"$ref": "#/$defs/string2"
@@ -319,8 +314,23 @@
319314
"null"
320315
]
321316
},
317+
"preventIncrementConfiguration": {
318+
"description": "The prevent increment configuration section.",
319+
"type": "object",
320+
"properties": {
321+
"of-merged-branch": {
322+
"$ref": "#/$defs/nullableOfBoolean2"
323+
},
324+
"when-branch-merged": {
325+
"$ref": "#/$defs/nullableOfBoolean2"
326+
},
327+
"when-current-commit-tagged": {
328+
"$ref": "#/$defs/nullableOfBoolean3"
329+
}
330+
}
331+
},
322332
"nullableOfBoolean2": {
323-
"description": "Prevent increment of merged branch version.",
333+
"description": "Prevent increment when branch merged.",
324334
"type": [
325335
"boolean",
326336
"null"

src/Directory.Build.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
</PropertyGroup>
4242

4343
<ItemGroup>
44-
<PackageReference Include="System.Text.Json"/>
4544
<PackageReference Include="Roslynator.Analyzers">
4645
<PrivateAssets>all</PrivateAssets>
4746
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/GitVersion.Core/Core/Attributes/JsonPropertyDefaultAttribute.cs renamed to src/GitVersion.Configuration/Attributes/JsonPropertyDefaultAttribute.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using GitVersion.Configuration;
2-
3-
namespace GitVersion.Attributes;
1+
namespace GitVersion.Configuration.Attributes;
42

53
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
64
public sealed class JsonPropertyDefaultAttribute : JsonAttribute
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#if GITVERSION_CONFIGURATION
2+
namespace GitVersion.Configuration.Attributes;
3+
#elif GITVERSION_OUTPUT
4+
namespace GitVersion.Output.Attributes;
5+
#endif
6+
7+
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
8+
public sealed class JsonPropertyDescriptionAttribute(string description) : JsonAttribute
9+
{
10+
/// <summary>
11+
/// The description of the property.
12+
/// </summary>
13+
public string Description { get; } = description;
14+
}

src/GitVersion.Core/Core/Attributes/JsonPropertyFormatAttribute.cs renamed to src/GitVersion.Configuration/Attributes/JsonPropertyFormatAttribute.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
namespace GitVersion.Attributes;
1+
namespace GitVersion.Configuration.Attributes;
22

33
/// <summary>
44
/// <para>The <c>format</c> keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. <c>format</c> allows the schema author to indicate that the string value should be interpreted as a date. By default, <c>format</c> is just an annotation and does not effect validation.</para>
55
/// <para>Optionally, validator implementations can [...] enable <c>format</c> to function as an assertion rather than just an annotation.</para>
66
/// <see href="https://json-schema.org/understanding-json-schema/reference/string#format"/>
77
/// </summary>
88
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
9-
public sealed class JsonPropertyFormatAttribute : JsonAttribute
9+
public sealed class JsonPropertyFormatAttribute(Format format) : JsonAttribute
1010
{
11-
/// <summary>
12-
/// Initializes a new instance of <see cref="JsonPropertyFormatAttribute"/> with the specified format for string-encoded property values. JSON validators may use this annotation to constrain properties to certain pre-define, string-encoded types.
13-
/// </summary>
14-
/// <param name="format">The string format.</param>
15-
public JsonPropertyFormatAttribute(Format format) => Format = format;
16-
1711
/// <summary>
1812
/// The format of the string.
1913
/// </summary>
20-
public Format Format { get; }
14+
public Format Format { get; } = format;
2115
}
2216

2317
/// <summary>

src/GitVersion.Configuration/BranchConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using GitVersion.Attributes;
1+
using GitVersion.Configuration.Attributes;
22
using GitVersion.Extensions;
33
using GitVersion.VersionCalculation;
44

0 commit comments

Comments
 (0)