Remove TODOs related to AllowOutOfOrderMetadataProperty workarounds. (#977)

This commit is contained in:
Eirik Tsarpalis 2025-11-18 20:08:30 +02:00 • committed by GitHub
commit 9e21d3e11d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View file

@ -25,7 +25,7 @@ namespace ModelContextProtocol.Protocol;
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for more details. /// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for more details.
/// </para> /// </para>
/// </remarks> /// </remarks>
[JsonConverter(typeof(Converter))] // TODO: This converter exists due to the lack of downlevel support for AllowOutOfOrderMetadataProperties. [JsonConverter(typeof(Converter))]
public abstract class ContentBlock public abstract class ContentBlock
{ {
/// <summary>Prevent external derivations.</summary> /// <summary>Prevent external derivations.</summary>
@ -55,6 +55,8 @@ public abstract class ContentBlock
/// <summary> /// <summary>
/// Provides a <see cref="JsonConverter"/> for <see cref="ContentBlock"/>. /// Provides a <see cref="JsonConverter"/> for <see cref="ContentBlock"/>.
/// </summary> /// </summary>
/// Provides a polymorphic converter for the <see cref="ContentBlock"/> class that doesn't require
/// setting <see cref="JsonSerializerOptions.AllowOutOfOrderMetadataProperties"/> explicitly.
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
public class Converter : JsonConverter<ContentBlock> public class Converter : JsonConverter<ContentBlock>
{ {

View file

@ -61,7 +61,7 @@ public sealed class ElicitRequestParams
/// Represents restricted subset of JSON Schema: /// Represents restricted subset of JSON Schema:
/// <see cref="StringSchema"/>, <see cref="NumberSchema"/>, <see cref="BooleanSchema"/>, or <see cref="EnumSchema"/>. /// <see cref="StringSchema"/>, <see cref="NumberSchema"/>, <see cref="BooleanSchema"/>, or <see cref="EnumSchema"/>.
/// </summary> /// </summary>
[JsonConverter(typeof(Converter))] // TODO: This converter exists due to the lack of downlevel support for AllowOutOfOrderMetadataProperties. [JsonConverter(typeof(Converter))]
public abstract class PrimitiveSchemaDefinition public abstract class PrimitiveSchemaDefinition
{ {
/// <summary>Prevent external derivations.</summary> /// <summary>Prevent external derivations.</summary>
@ -84,6 +84,8 @@ public sealed class ElicitRequestParams
/// <summary> /// <summary>
/// Provides a <see cref="JsonConverter"/> for <see cref="ResourceContents"/>. /// Provides a <see cref="JsonConverter"/> for <see cref="ResourceContents"/>.
/// </summary> /// </summary>
/// Provides a polymorphic converter for the <see cref="PrimitiveSchemaDefinition"/> class that doesn't require
/// setting <see cref="JsonSerializerOptions.AllowOutOfOrderMetadataProperties"/> explicitly.
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
public class Converter : JsonConverter<PrimitiveSchemaDefinition> public class Converter : JsonConverter<PrimitiveSchemaDefinition>
{ {

View file

@ -39,6 +39,10 @@ public abstract class Reference
/// <summary> /// <summary>
/// Provides a <see cref="JsonConverter"/> for <see cref="Reference"/>. /// Provides a <see cref="JsonConverter"/> for <see cref="Reference"/>.
/// </summary> /// </summary>
/// <remarks>
/// Provides a polymorphic converter for the <see cref="Reference"/> class that doesn't require
/// setting <see cref="JsonSerializerOptions.AllowOutOfOrderMetadataProperties"/> explicitly.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
public sealed class Converter : JsonConverter<Reference> public sealed class Converter : JsonConverter<Reference>
{ {
@ -95,8 +99,6 @@ public abstract class Reference
} }
} }
// TODO: This converter exists due to the lack of downlevel support for AllowOutOfOrderMetadataProperties.
switch (type) switch (type)
{ {
case "ref/prompt": case "ref/prompt":