Skip to content

improvement: upgrade json-schema-validator to 2.0.0#131

Merged
junjiem merged 1 commit intomainfrom
improvement/upgrade_json_schema_validator
Nov 13, 2025
Merged

improvement: upgrade json-schema-validator to 2.0.0#131
junjiem merged 1 commit intomainfrom
improvement/upgrade_json_schema_validator

Conversation

@junjiem
Copy link
Copy Markdown
Collaborator

@junjiem junjiem commented Nov 13, 2025

Summary by CodeRabbit

  • Chores
    • Updated schema validation library to latest version.
    • Refactored internal validation handling to use modernized schema management approach.

@junjiem junjiem merged commit 7138467 into main Nov 13, 2025
1 check was pending
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The com.networknt:json-schema-validator dependency was upgraded from 1.5.8 to 2.0.0 in pom.xml. Utility classes were refactored to migrate from JsonSchema-based validation to SchemaRegistry-based approach, updating method signatures to return List<Error> instead of Set<ValidationMessage>.

Changes

Cohort / File(s) Summary
Dependency upgrade
dat-sdk/pom.xml
Updated com.networknt:json-schema-validator from version 1.5.8 to 2.0.0
Validation migration
dat-sdk/src/main/java/ai/dat/core/factories/DatProjectFactory.java, dat-sdk/src/main/java/ai/dat/core/utils/DatProjectUtil.java, dat-sdk/src/main/java/ai/dat/core/utils/DatSchemaUtil.java
Migrated from JsonSchemaFactory/JsonSchema to SchemaRegistry/Schema approach; replaced Set<ValidationMessage> with List<Error> in method signatures; updated YAML validation logic and error handling to use new schema registry API

Sequence Diagram

sequenceDiagram
    participant Client
    participant Validator as DatSchemaUtil<br/>(Validator)
    participant OldLib as Old Library<br/>(v1.5.8)
    participant NewLib as New Library<br/>(v2.0.0)
    
    rect rgb(220, 240, 255)
    Note over OldLib: Previous Flow
    Client->>Validator: validate(yamlContent)
    Validator->>OldLib: JsonSchemaFactory.getSchema()
    OldLib-->>Validator: JsonSchema instance
    Validator->>OldLib: jsonSchema.validate()
    OldLib-->>Validator: Set<ValidationMessage>
    Validator-->>Client: Throw ValidationException or return errors
    end
    
    rect rgb(240, 255, 240)
    Note over NewLib: New Flow (v2.0.0)
    Client->>Validator: validate(yamlContent)
    Validator->>NewLib: SchemaRegistry.getSchema()
    NewLib-->>Validator: Schema instance
    Validator->>NewLib: schema.validate(jsonNode)
    NewLib-->>Validator: List<Error>
    Validator-->>Client: Throw ValidationException or return errors
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Key attention areas:
    • Verify return type changes (Set<ValidationMessage>List<Error>) propagate correctly through calling code
    • Confirm SchemaRegistry initialization and schema loading logic in static blocks is correct
    • Check error handling semantics remain equivalent between old and new validation API
    • Validate that the JSON_MAPPER.readTree() parsing maintains compatibility with existing YAML validation expectations

Poem

🐰 From JsonSchema's nest we hop away,
To SchemaRegistry's modern way,
Error lists now guide our validation dance,
Version two-point-oh—a library advance!
Validation rules renewed in every chance! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improvement/upgrade_json_schema_validator

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d74b6f and 2642efd.

📒 Files selected for processing (4)
  • dat-sdk/pom.xml (1 hunks)
  • dat-sdk/src/main/java/ai/dat/core/factories/DatProjectFactory.java (2 hunks)
  • dat-sdk/src/main/java/ai/dat/core/utils/DatProjectUtil.java (3 hunks)
  • dat-sdk/src/main/java/ai/dat/core/utils/DatSchemaUtil.java (4 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@junjiem junjiem deleted the improvement/upgrade_json_schema_validator branch November 13, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant