fix(agent): remake JsonUtil - #515
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 onlyjsonrepairfor JSON correction - Moved
stringifyValidateFailurelogic from a standalone module intoJsonUtil - Removed
es-jsonkitdependency 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
jsonrepairlibrary, moving and enhancing thestringifyValidateFailurelogic intoJsonUtil, and updating all related usages and tests accordingly.JSON utility refactor and validation failure handling:
JsonUtilutility is refactored to use onlyjsonrepairfor JSON correction, removing the previous multi-step correction pipeline and the dependency ones-jsonkit. (packages/core/package.json,packages/core/src/utils/JsonUtil.ts) [1] [2]stringifyValidateFailurefunction is moved intoJsonUtil, rewritten for clarity, and now provides improved annotated output for validation failures, including missing properties and error comments. (packages/core/src/utils/JsonUtil.ts)stringifyValidateFailureare updated to reference the newJsonUtil.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:
JsonUtil.parsetest suite is removed, likely because the correction logic it tested is now handled byjsonrepairand/or is no longer relevant. (packages/core/src/utils/JsonUtil.spec.ts)JsonUtil.stringifyValidateFailureand remain comprehensive. (packages/core/src/utils/stringifyValidateFailure.spec.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]