Skip to content

Commit aa13a75

Browse files
committed
using generic JsonStringEnumConverter for net8.0
1 parent 44366de commit aa13a75

File tree

12 files changed

+6
-12
lines changed

12 files changed

+6
-12
lines changed

src/GeoJSON.Text/Feature/Feature.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public Feature(IGeometryObject geometry, TProps properties, string id = null)
4949

5050
[JsonPropertyName("type")]
5151
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
52-
[JsonConverter(typeof(JsonStringEnumConverter))]
5352
public override GeoJSONObjectType Type => GeoJSONObjectType.Feature;
5453

5554
[JsonPropertyName( "id")]

src/GeoJSON.Text/Feature/FeatureCollection.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public FeatureCollection(List<Feature> features)
3737

3838
[JsonPropertyName("type")]
3939
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
40-
[JsonConverter(typeof(JsonStringEnumConverter))]
4140
public override GeoJSONObjectType Type => GeoJSONObjectType.FeatureCollection;
4241

4342
/// <summary>
@@ -156,7 +155,6 @@ public FeatureCollection(List<Feature<IGeometryObject, TProps>> features)
156155

157156
[JsonPropertyName("type")]
158157
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
159-
[JsonConverter(typeof(JsonStringEnumConverter))]
160158
public override GeoJSONObjectType Type => GeoJSONObjectType.FeatureCollection;
161159

162160
/// <summary>

src/GeoJSON.Text/GeoJSONObject.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public abstract class GeoJSONObject : IGeoJSONObject, IEqualityComparer<GeoJSONO
5555
/// </summary>
5656
[JsonPropertyName("type")]
5757
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
58-
[JsonConverter(typeof(JsonStringEnumConverter))]
5958
public abstract GeoJSONObjectType Type { get; }
6059

6160

src/GeoJSON.Text/GeoJSONObjectType.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
22

33
using System.Runtime.Serialization;
4+
using System.Text.Json.Serialization;
45

56
namespace GeoJSON.Text
67
{
78
/// <summary>
89
/// Defines the GeoJSON Objects types.
910
/// </summary>
11+
#if NET8_0_OR_GREATER
12+
[JsonConverter(typeof(JsonStringEnumConverter<GeoJSONObjectType>))]
13+
#else
14+
[JsonConverter(typeof(JsonStringEnumConverter))]
15+
#endif
1016
public enum GeoJSONObjectType
1117
{
1218
/// <summary>

src/GeoJSON.Text/Geometry/GeometryCollection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public GeometryCollection(IEnumerable<IGeometryObject> geometries)
3636

3737
[JsonPropertyName("type")]
3838
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
39-
[JsonConverter(typeof(JsonStringEnumConverter))]
4039
public override GeoJSONObjectType Type => GeoJSONObjectType.GeometryCollection;
4140

4241
/// <summary>

src/GeoJSON.Text/Geometry/IGeometryObject.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public interface IGeometryObject
2323
/// The type of the object.
2424
/// </value>
2525
[JsonPropertyName("type")]
26-
[JsonConverter(typeof(JsonStringEnumConverter))]
2726
GeoJSONObjectType Type { get; }
2827
}
2928
}

src/GeoJSON.Text/Geometry/LineString.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public LineString(IEnumerable<IPosition> coordinates)
5252

5353
[JsonPropertyName("type")]
5454
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
55-
[JsonConverter(typeof(JsonStringEnumConverter))]
5655
public override GeoJSONObjectType Type => GeoJSONObjectType.LineString;
5756

5857
/// <summary>

src/GeoJSON.Text/Geometry/MultiLineString.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public MultiLineString(IEnumerable<IEnumerable<IEnumerable<double>>> coordinates
4646

4747
[JsonPropertyName("type")]
4848
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
49-
[JsonConverter(typeof(JsonStringEnumConverter))]
5049
public override GeoJSONObjectType Type => GeoJSONObjectType.MultiLineString;
5150

5251
/// <summary>

src/GeoJSON.Text/Geometry/MultiPoint.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public MultiPoint(IEnumerable<IEnumerable<double>> coordinates)
4040

4141
[JsonPropertyName("type")]
4242
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
43-
[JsonConverter(typeof(JsonStringEnumConverter))]
4443
public override GeoJSONObjectType Type => GeoJSONObjectType.MultiPoint;
4544

4645
/// <summary>

src/GeoJSON.Text/Geometry/MultiPolygon.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public MultiPolygon(IEnumerable<IEnumerable<IEnumerable<IEnumerable<double>>>> c
4242

4343
[JsonPropertyName("type")]
4444
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
45-
[JsonConverter(typeof(JsonStringEnumConverter))]
4645
public override GeoJSONObjectType Type => GeoJSONObjectType.MultiPolygon;
4746

4847
/// <summary>

0 commit comments

Comments
 (0)