Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions agentscope-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
<artifactId>jsonschema-module-jackson</artifactId>
</dependency>

<!-- Jackson 3.x (tools.jackson) required by jsonschema-generator 5.x -->
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<!-- Jackson Java 8 Date/Time support -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public class JsonSchemaUtils {
*/
public static Map<String, Object> generateSchemaFromClass(Class<?> clazz) {
try {
JsonNode schemaNode = schemaGenerator.generateSchema(clazz);
String schemaJson = schemaGenerator.generateSchema(clazz).toString();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Minor observation (not blocking): schemaGenerator.generateSchema(clazz).toString() + fromJson(...) round-trips the entire schema through a JSON string. For one-shot schema generation per Class/Type (called from ToolSchemaGenerator and StructuredOutputCapableAgent) this overhead is negligible, and the chosen approach is the cleanest way to keep Jackson 2 dominant elsewhere — so this is fine as-is. The alternative would be a dedicated Jackson 3 ObjectMapper doing convertValue(node, Map.class) directly, but that would couple JsonSchemaUtils to Jackson 3 internals, which is arguably worse. Recommended to keep the current bridge but add a brief inline comment explaining the rationale so future maintainers don't try to 'optimize' it back.

return JsonUtils.getJsonCodec()
.convertValue(schemaNode, new TypeReference<Map<String, Object>>() {});
.fromJson(schemaJson, new TypeReference<Map<String, Object>>() {});
} catch (Exception e) {
throw new RuntimeException("Failed to generate JSON schema for " + clazz.getName(), e);
}
Expand Down Expand Up @@ -130,9 +130,9 @@ public static Map<String, Object> generateSchemaFromJsonNode(JsonNode schema) {
*/
public static Map<String, Object> generateSchemaFromType(Type type) {
try {
JsonNode schemaNode = schemaGenerator.generateSchema(type);
String schemaJson = schemaGenerator.generateSchema(type).toString();
return JsonUtils.getJsonCodec()
.convertValue(schemaNode, new TypeReference<Map<String, Object>>() {});
.fromJson(schemaJson, new TypeReference<Map<String, Object>>() {});
} catch (Exception e) {
throw new RuntimeException(
"Failed to generate JSON schema for " + type.getTypeName(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.fasterxml.jackson.databind.JsonNode;
import com.github.victools.jsonschema.generator.OptionPreset;
import com.github.victools.jsonschema.generator.SchemaGenerator;
import com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder;
import com.github.victools.jsonschema.generator.SchemaVersion;
import java.util.List;
import java.util.stream.StreamSupport;
import org.junit.jupiter.api.Test;
import tools.jackson.databind.JsonNode;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] While migrating this test to the Jackson 3 JsonNode, the existing .asText() calls in requiredList(...) and the assertEquals(... .asText()) assertions remain. In Jackson 3.x asText() is @Deprecated (delegates to asString()). Compilation still works, but consider switching to asString() in this file as part of the same migration to silence deprecation warnings and align with the Jackson 3 idiom. Not blocking.


/**
* Tests for {@link ToolSchemaModule}.
Expand Down
18 changes: 10 additions & 8 deletions agentscope-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@
<spring.version>7.0.7</spring.version>
<spring-boot.version>4.0.4</spring-boot.version>
<nacos-client.version>3.2.1-2026.03.30</nacos-client.version>
<json-schema-validator.version>2.0.0</json-schema-validator.version>
<jsonschema-generator.version>4.38.0</jsonschema-generator.version>
<json-schema-validator.version>3.0.0</json-schema-validator.version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] This PR also bumps com.networknt:json-schema-validator 2.0.0 → 3.0.0, which is a separate library from victools jsonschema-generator and itself a major release that internally moves to Jackson 3 (per its 3.0.0 release notes). The PR title and description only mention jsonschema-generator, so this bundled upgrade is easy to miss. ToolValidator (the only consumer) is not modified and its class names (SchemaRegistry, Schema, Error, InputFormat) appear unchanged, but please either (a) document the validator upgrade in the PR description with a brief note that the existing schema-validation tests still pass, or (b) split it into a separate commit/PR — this aids future bisecting if a validator-side regression surfaces.

<jsonschema-generator.version>5.0.0</jsonschema-generator.version>
<jackson3.version>3.0.4</jackson3.version>
<snakeyaml.version>2.6</snakeyaml.version>
<tree-sitter.version>0.24.4</tree-sitter.version>
<tree-sitter-bash.version>0.23.3</tree-sitter-bash.version>
Expand Down Expand Up @@ -476,12 +477,6 @@
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator</artifactId>
<version>${jsonschema-generator.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Victools JSON Schema Module for Jackson annotations support -->
Expand All @@ -491,6 +486,13 @@
<version>${jsonschema-generator.version}</version>
</dependency>

<!-- Jackson 3.x (tools.jackson) required by jsonschema-generator 5.x -->
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson3.version}</version>
</dependency>

<!-- Apache Commons Lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
6 changes: 6 additions & 0 deletions agentscope-distribution/agentscope-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@
<artifactId>jsonschema-module-jackson</artifactId>
</dependency>

<!-- Jackson 3.x (tools.jackson) required by jsonschema-generator 5.x -->
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<!-- JSON Schema Validator for tool input validation -->
<dependency>
<groupId>com.networknt</groupId>
Expand Down
Loading