From d6f648f8b8a361fe76844b28f1f9385551ddd7fd Mon Sep 17 00:00:00 2001 From: Karol Date: Thu, 28 May 2026 23:58:34 +0200 Subject: [PATCH] Remove duplicate deprecated spec.JsonSchemaValidator (#666) There were two JsonSchemaValidator types in the codebase: io.modelcontextprotocol.spec.JsonSchemaValidator (deprecated) and io.modelcontextprotocol.json.schema.JsonSchemaValidator (the one in use). As noted by a maintainer in the issue, the deprecated one in the spec package should be removed. It was already annotated @Deprecated pointing to the json.schema variant, and nothing references it: no imports, no fully-qualified usages, and no wildcard imports of the spec package resolve to it. All production and test code already uses io.modelcontextprotocol.json.schema.JsonSchemaValidator. Fixes #666 --- .../spec/JsonSchemaValidator.java | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 mcp-core/src/main/java/io/modelcontextprotocol/spec/JsonSchemaValidator.java diff --git a/mcp-core/src/main/java/io/modelcontextprotocol/spec/JsonSchemaValidator.java b/mcp-core/src/main/java/io/modelcontextprotocol/spec/JsonSchemaValidator.java deleted file mode 100644 index 87b08193c..000000000 --- a/mcp-core/src/main/java/io/modelcontextprotocol/spec/JsonSchemaValidator.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2024-2024 the original author or authors. - */ - -package io.modelcontextprotocol.spec; - -import java.util.Map; - -/** - * Interface for validating structured content against a JSON schema. This interface - * defines a method to validate structured content based on the provided output schema. - * - * @author Christian Tzolov - * @deprecated Use {@link io.modelcontextprotocol.json.schema.JsonSchemaValidator} - */ -@Deprecated -public interface JsonSchemaValidator { - - /** - * Represents the result of a validation operation. - * - * @param valid Indicates whether the validation was successful. - * @param errorMessage An error message if the validation failed, otherwise null. - * @param jsonStructuredOutput The text structured content in JSON format if the - * validation was successful, otherwise null. - */ - public record ValidationResponse(boolean valid, String errorMessage, String jsonStructuredOutput) { - - public static ValidationResponse asValid(String jsonStructuredOutput) { - return new ValidationResponse(true, null, jsonStructuredOutput); - } - - public static ValidationResponse asInvalid(String message) { - return new ValidationResponse(false, message, null); - } - } - - /** - * Validates the structured content against the provided JSON schema. - * @param schema The JSON schema to validate against. - * @param structuredContent The structured content to validate. - * @return A ValidationResponse indicating whether the validation was successful or - * not. - */ - ValidationResponse validate(Map schema, Object structuredContent); - -}