Move mcp-json into mcp-core, add OSGi support
Co-authored-by: Luca Chang <131398524+LucaButBoring@users.noreply.github.com> Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
parent
be5ec12e1b
commit
c3b9ab09ea
4 changed files with 368 additions and 353 deletions
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.modelcontextprotocol.json.McpJsonMapper;
|
||||
import io.modelcontextprotocol.json.McpJsonDefaults;
|
||||
import io.modelcontextprotocol.json.TypeRef;
|
||||
import io.modelcontextprotocol.spec.McpClientTransport;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
|
|
@ -100,7 +100,7 @@ public class MockMcpClientTransport implements McpClientTransport {
|
|||
|
||||
@Override
|
||||
public <T> T unmarshalFrom(Object data, TypeRef<T> typeRef) {
|
||||
return McpJsonMapper.getDefault().convertValue(data, typeRef);
|
||||
return McpJsonDefaults.getDefaultMcpJsonMapper().convertValue(data, typeRef);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import io.modelcontextprotocol.json.McpJsonMapper;
|
||||
import io.modelcontextprotocol.json.McpJsonDefaults;
|
||||
import io.modelcontextprotocol.json.TypeRef;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.modelcontextprotocol.spec.McpSchema.JSONRPCNotification;
|
||||
|
|
@ -68,7 +68,7 @@ public class MockMcpServerTransport implements McpServerTransport {
|
|||
|
||||
@Override
|
||||
public <T> T unmarshalFrom(Object data, TypeRef<T> typeRef) {
|
||||
return McpJsonMapper.getDefault().convertValue(data, typeRef);
|
||||
return McpJsonDefaults.getDefaultMcpJsonMapper().convertValue(data, typeRef);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package io.modelcontextprotocol.spec;
|
||||
|
||||
import io.modelcontextprotocol.json.McpJsonDefaults;
|
||||
import io.modelcontextprotocol.json.McpJsonMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.io.IOException;
|
||||
|
|
@ -10,7 +11,7 @@ class CompleteCompletionSerializationTest {
|
|||
|
||||
@Test
|
||||
void codeCompletionSerialization() throws IOException {
|
||||
McpJsonMapper jsonMapper = McpJsonMapper.getDefault();
|
||||
McpJsonMapper jsonMapper = McpJsonDefaults.getDefaultMcpJsonMapper();
|
||||
McpSchema.CompleteResult.CompleteCompletion codeComplete = new McpSchema.CompleteResult.CompleteCompletion(
|
||||
Collections.emptyList(), 0, false);
|
||||
String json = jsonMapper.writeValueAsString(codeComplete);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package io.modelcontextprotocol.util;
|
||||
|
||||
import io.modelcontextprotocol.json.McpJsonDefaults;
|
||||
import io.modelcontextprotocol.json.McpJsonMapper;
|
||||
|
||||
public final class McpJsonMapperUtils {
|
||||
|
|
@ -7,6 +8,6 @@ public final class McpJsonMapperUtils {
|
|||
private McpJsonMapperUtils() {
|
||||
}
|
||||
|
||||
public static final McpJsonMapper JSON_MAPPER = McpJsonMapper.getDefault();
|
||||
public static final McpJsonMapper JSON_MAPPER = McpJsonDefaults.getDefaultMcpJsonMapper();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue