<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2025 Callibrity, Inc. (contactus@callibrity.com)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.callibrity.mocapi</groupId>
        <artifactId>mocapi-parent</artifactId>
        <version>0.13.0</version>
    </parent>

    <artifactId>mocapi-jakarta-validation</artifactId>
    <name>Mocapi - Jakarta Validation</name>
    <description>Jakarta Bean Validation for mocapi handlers. Bundles Hibernate-backed Validator (spring-boot-starter-validation), methodical's JakartaMethodValidatorFactory, and ripcurl's ConstraintViolationException-to-JSON-RPC translator. Adding this module to the classpath lets users annotate @McpTool / @McpPrompt / @McpResourceTemplate parameters with @NotBlank/@Size/@Pattern/etc.; violations in prompt and resource handlers surface as JSON-RPC -32602 Invalid params with per-violation detail in the response's data field, and violations in tool handlers surface as CallToolResult.isError=true — matching the MCP 2025-11-25 spec's error-reporting model for each handler type.</description>

    <!--
        This module ships no code of its own — every piece of the validation story is already
        built elsewhere:

        - spring-boot-starter-validation provides Hibernate Validator + Jakarta EL + the
          jakarta.validation-api. Spring Boot auto-wires a Validator bean.
        - methodical-jakarta-validation's autoconfigure layer sees the Validator and registers
          JakartaMethodValidatorFactory as a MethodValidatorFactory bean. Methodical's
          invoker factory then wraps every reflective method call (user @McpTool,
          @McpPrompt, @McpResourceTemplate, and mocapi's own @JsonRpcMethod handlers)
          with param validation.
        - ripcurl-jakarta-validation contributes a ConstraintViolationExceptionTranslator that
          maps jakarta.validation.ConstraintViolationException to JSON-RPC -32602 with the
          per-violation list in the error's data field.

        mocapi-server deliberately does NOT depend on jakarta.validation. Its internal protocol
        handlers use hand-rolled checks so they work regardless of consumer classpath; this
        module is purely user-facing.
    -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jwcarman.methodical</groupId>
            <artifactId>methodical-jakarta-validation</artifactId>
            <version>${methodical.version}</version>
        </dependency>
        <dependency>
            <groupId>com.callibrity.ripcurl</groupId>
            <artifactId>ripcurl-jakarta-validation</artifactId>
            <version>${ripcurl.version}</version>
        </dependency>
    </dependencies>
</project>
