Class JsonSchemaConverter

java.lang.Object
org.springframework.ai.vertexai.gemini.schema.JsonSchemaConverter

public final class JsonSchemaConverter extends Object
Utility class for converting JSON Schema to OpenAPI schema format.
  • Method Details

    • fromJson

      public static com.fasterxml.jackson.databind.node.ObjectNode fromJson(String jsonString)
      Parses a JSON string into an ObjectNode.
      Parameters:
      jsonString - The JSON string to parse
      Returns:
      ObjectNode containing the parsed JSON
      Throws:
      RuntimeException - if the JSON string cannot be parsed
    • convertToOpenApiSchema

      public static com.fasterxml.jackson.databind.node.ObjectNode convertToOpenApiSchema(com.fasterxml.jackson.databind.node.ObjectNode jsonSchemaNode)
      Converts a JSON Schema ObjectNode to OpenAPI schema format.
      Parameters:
      jsonSchemaNode - The input JSON Schema as ObjectNode
      Returns:
      ObjectNode containing the OpenAPI schema
      Throws:
      IllegalArgumentException - if jsonSchemaNode is null