Ignore unexpected properties when deserializing a ContentBlock (#956)

* Ignore unexpected properties when deserializing a ContentBlock

* Fix deserialization of Reference.Title and more bugs for unknown props

* Remove comments about skipping additional properties
This commit is contained in:
Jeff Handley 2025-11-09 01:00:55 -08:00 • committed by GitHub
commit d4ee78797b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1762 additions and 1 deletions

View file

@ -141,6 +141,7 @@ public abstract class ContentBlock
break;
default:
reader.Skip();
break;
}
}

View file

@ -188,6 +188,7 @@ public sealed class ElicitRequestParams
break;
default:
reader.Skip();
break;
}
}

View file

@ -81,6 +81,10 @@ public sealed class ProgressNotificationParams : NotificationParams
case "_meta":
meta = JsonSerializer.Deserialize(ref reader, McpJsonUtilities.JsonContext.Default.JsonObject);
break;
default:
reader.Skip();
break;
}
}
}

View file

@ -81,11 +81,16 @@ public abstract class Reference
name = reader.GetString();
break;
case "title":
title = reader.GetString();
break;
case "uri":
uri = reader.GetString();
break;
default:
reader.Skip();
break;
}
}

View file

@ -116,6 +116,7 @@ public abstract class ResourceContents
break;
default:
reader.Skip();
break;
}
}