Skip to content

Commit d099623

Browse files
committed
Rename custom enum converter
1 parent e6e1162 commit d099623

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/ModelContextProtocol/Protocol/Types/ContextInclusion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types;
66
/// A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
77
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
88
/// </summary>
9-
[JsonConverter(typeof(JsonStringEnumConverterWithEnumMemberAttrSupport<ContextInclusion>))]
9+
[JsonConverter(typeof(CustomizableJsonStringEnumConverter<ContextInclusion>))]
1010
public enum ContextInclusion
1111
{
1212
/// <summary>

src/ModelContextProtocol/Protocol/Types/LoggingLevel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ModelContextProtocol.Protocol.Types;
77
/// These map to syslog message severities, as specified in RFC-5424:
88
/// https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
99
/// </summary>
10-
[JsonConverter(typeof(JsonStringEnumConverterWithEnumMemberAttrSupport<LoggingLevel>))]
10+
[JsonConverter(typeof(CustomizableJsonStringEnumConverter<LoggingLevel>))]
1111
public enum LoggingLevel
1212
{
1313
/// <summary>Detailed debug information, typically only valuable to developers.</summary>

src/ModelContextProtocol/Protocol/Types/Role.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types;
66
/// Represents the type of role in the conversation.
77
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
88
/// </summary>
9-
[JsonConverter(typeof(JsonStringEnumConverterWithEnumMemberAttrSupport<Role>))]
9+
[JsonConverter(typeof(CustomizableJsonStringEnumConverter<Role>))]
1010
public enum Role
1111
{
1212
/// <summary>

src/ModelContextProtocol/Utils/Json/JsonStringEnumConverterWithEnumMemberAttrSupport.cs renamed to src/ModelContextProtocol/Utils/Json/CustomizableJsonStringEnumConverter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
namespace System.Text.Json.Serialization;
1313

14-
internal sealed class JsonStringEnumConverterWithEnumMemberAttrSupport<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TEnum> :
14+
internal sealed class CustomizableJsonStringEnumConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TEnum> :
1515
JsonStringEnumConverter<TEnum> where TEnum : struct, Enum
1616
{
17-
public JsonStringEnumConverterWithEnumMemberAttrSupport() :
17+
#if !NET9_0_OR_GREATER
18+
public CustomizableJsonStringEnumConverter() :
1819
base(namingPolicy: ResolveNamingPolicy())
1920
{
2021
}
@@ -36,6 +37,7 @@ public override string ConvertName(string name) =>
3637
newName :
3738
name;
3839
}
40+
#endif
3941
}
4042

4143
#if !NET9_0_OR_GREATER

0 commit comments

Comments
 (0)