Skip to content

fix(agent): remake JsonUtil - #515

Merged
samchon merged 1 commit into
mainfrom
fix/json-util
Jan 1, 2026
Merged

fix(agent): remake JsonUtil#515
samchon merged 1 commit into
mainfrom
fix/json-util

Conversation

@samchon

@samchon samchon commented Jan 1, 2026

Copy link
Copy Markdown
Member

This pull request refactors and simplifies JSON utility handling and validation failure stringification in the core package. The main changes include consolidating JSON correction logic to use only the jsonrepair library, moving and enhancing the stringifyValidateFailure logic into JsonUtil, and updating all related usages and tests accordingly.

JSON utility refactor and validation failure handling:

  • The JsonUtil utility is refactored to use only jsonrepair for JSON correction, removing the previous multi-step correction pipeline and the dependency on es-jsonkit. (packages/core/package.json, packages/core/src/utils/JsonUtil.ts) [1] [2]
  • The stringifyValidateFailure function is moved into JsonUtil, rewritten for clarity, and now provides improved annotated output for validation failures, including missing properties and error comments. (packages/core/src/utils/JsonUtil.ts)
  • All usages of stringifyValidateFailure are updated to reference the new JsonUtil.stringifyValidateFailure. (packages/core/src/orchestrate/call.ts, packages/core/src/utils/stringifyValidateFailure.spec.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Test updates and cleanup:

  • The standalone JsonUtil.parse test suite is removed, likely because the correction logic it tested is now handled by jsonrepair and/or is no longer relevant. (packages/core/src/utils/JsonUtil.spec.ts)
  • The tests for validation failure stringification are updated to use the new JsonUtil.stringifyValidateFailure and remain comprehensive. (packages/core/src/utils/stringifyValidateFailure.spec.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

@samchon samchon self-assigned this Jan 1, 2026
Copilot AI review requested due to automatic review settings January 1, 2026 02:05
@samchon samchon added bug Something isn't working enhancement New feature or request dependencies Pull requests that update a dependency file labels Jan 1, 2026
@samchon samchon added this to WrtnLabs Jan 1, 2026
@samchon
samchon merged commit 8d9fc1e into main Jan 1, 2026
10 of 16 checks passed
@samchon
samchon deleted the fix/json-util branch January 1, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors JSON utility handling by consolidating JSON correction logic to use only the jsonrepair library and moving the stringifyValidateFailure function into JsonUtil. The changes remove the dependency on es-jsonkit and simplify the JSON parsing implementation.

Key changes:

  • Simplified JsonUtil.parse() to use only jsonrepair for JSON correction
  • Moved stringifyValidateFailure logic from a standalone module into JsonUtil
  • Removed es-jsonkit dependency from the project

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Removes es-jsonkit package dependency and type-fest catalog entry
packages/core/package.json Removes es-jsonkit from dependencies
packages/core/src/utils/JsonUtil.ts Simplifies parse to use only jsonrepair; adds stringifyValidateFailure and helper functions
packages/core/src/utils/stringifyValidateFailure.ts File deleted (functionality moved to JsonUtil)
packages/core/src/utils/stringifyValidateFailure.spec.ts Updates all test references to use JsonUtil.stringifyValidateFailure
packages/core/src/utils/JsonUtil.spec.ts File deleted (parse tests removed entirely)
packages/core/src/orchestrate/call.ts Updates imports and function calls to use JsonUtil.stringifyValidateFailure
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/utils/stringifyValidateFailure.spec.ts
Comment thread packages/core/src/utils/JsonUtil.ts
Comment thread packages/core/src/utils/JsonUtil.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants