Add Support for Jackson 3 (#742)
This change adds Jackson 3 support and aligns package naming in the existing Jackson 2 module. Specific changes: * Deprecated classes for removal in `io.modelcontextprotocol.json.jackson`/`io.modelcontextprotocol.json.schema.jackson` * Copied the above to `io.modelcontextprotocol.json.jackson2`/`io.modelcontextprotocol.json.schema.jackson2` in non-deprecated form. * Added tests for the default McpJsonMapper and JsonSchemaValidator
This commit is contained in:
parent
af65356416
commit
2456a0e433
1 changed files with 2487 additions and 21 deletions
|
|
@ -10,6 +10,7 @@ import static net.javacrumbs.jsonunit.assertj.JsonAssertions.json;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -18,7 +19,7 @@ import java.util.Map;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.exc.InvalidTypeIdException;
|
||||
import tools.jackson.databind.exc.InvalidTypeIdException;
|
||||
|
||||
import io.modelcontextprotocol.spec.McpSchema.TextResourceContents;
|
||||
import net.javacrumbs.jsonunit.core.Option;
|
||||
|
|
@ -58,7 +59,9 @@ public class McpSchemaTests {
|
|||
void testContentDeserializationWrongType() throws Exception {
|
||||
|
||||
assertThatThrownBy(() -> JSON_MAPPER.readValue("""
|
||||
{"type":"WRONG","text":"XXX"}""", McpSchema.TextContent.class))
|
||||
{"type":"WRONG","text":"XXX"}""", McpSchema.TextContent.class)).isInstanceOf(IOException.class)
|
||||
.hasMessage("Failed to read value")
|
||||
.cause()
|
||||
.isInstanceOf(InvalidTypeIdException.class)
|
||||
.hasMessageContaining(
|
||||
"Could not resolve type id 'WRONG' as a subtype of `io.modelcontextprotocol.spec.McpSchema$TextContent`: known type ids = [audio, image, resource, resource_link, text]");
|
||||
|
|
|
|||
Loading…
Reference in a new issue