Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions conformance-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Tests the conformance server against all server scenarios:

## Known SDK Limitations

10 scenarios are expected to fail due to current SDK limitations (tracked in [
9 scenarios are expected to fail due to current SDK limitations (tracked in [
`conformance-baseline.yml`](conformance-baseline.yml).

| Scenario | Suite | Root Cause |
Expand All @@ -122,7 +122,6 @@ Tests the conformance server against all server scenarios:
| `elicitation-sep1034-defaults` | server | *(same as above)* |
| `elicitation-sep1330-enums` | server | *(same as above)* |
| `resources-templates-read` | server | SDK does not implement `addResourceTemplate()` with URI pattern matching; resources are looked up by exact URI |
| `initialize` | client | Conformance server sends a JSON-RPC response without `id`; `JSONRPCResponse.id` is non-nullable so deserialization fails |
| `elicitation-sep1034-client-defaults` | client | SDK does not fill in `default` values from the elicitation request schema before sending the response |
| `sse-retry` | client | Transport does not respect the SSE `retry` field timing or send `Last-Event-ID` on reconnection |

Expand Down
1 change: 0 additions & 1 deletion conformance-test/conformance-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ server:
- resources-templates-read

client:
- initialize
- elicitation-sep1034-client-defaults
- sse-retry
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,23 @@ internal object ServerResultPolymorphicSerializer :
* Polymorphic serializer for [JSONRPCMessage] types.
* Determines the message type based on the presence of specific fields:
* - "error" -> JSONRPCError
* - "result" -> JSONRPCResponse
* - "result" + "id" -> JSONRPCResponse
* - "result" -> JSONRPCEmptyMessage
* - "method" + "id" -> JSONRPCRequest
* - "method" -> JSONRPCNotification
*/
internal object JSONRPCMessagePolymorphicSerializer :
JsonContentPolymorphicSerializer<JSONRPCMessage>(JSONRPCMessage::class) {
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<JSONRPCMessage> {
val jsonObject = element.jsonObject
val jsonObj = element.jsonObject

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check if we can fix it with schema changes. Could you log an issue to review for this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure
we already have an issue for the json rpc response #545
I added a comment about this case

return when {
"error" in jsonObject -> JSONRPCError.serializer()
"result" in jsonObject -> JSONRPCResponse.serializer()
"method" in jsonObject && "id" in jsonObject -> JSONRPCRequest.serializer()
"method" in jsonObject -> JSONRPCNotification.serializer()
jsonObject.isEmpty() || jsonObject.keys == setOf("jsonrpc") -> JSONRPCEmptyMessage.serializer()
else -> throw SerializationException("Invalid JSONRPCMessage type: ${jsonObject.keys}")
"error" in jsonObj -> JSONRPCError.serializer()
"result" in jsonObj && "id" in jsonObj -> JSONRPCResponse.serializer()
"result" in jsonObj && jsonObj["result"]?.jsonObject?.isEmpty() == true -> JSONRPCEmptyMessage.serializer()
"method" in jsonObj && "id" in jsonObj -> JSONRPCRequest.serializer()
"method" in jsonObj -> JSONRPCNotification.serializer()
jsonObj.isEmpty() || jsonObj.keys == setOf("jsonrpc") -> JSONRPCEmptyMessage.serializer()
else -> throw SerializationException("Invalid JSONRPCMessage type: ${jsonObj.keys}")
}
}
}
Expand Down
Loading