Skip to content

chore(json): Typing improvements#9641

Merged
ibgreen merged 16 commits intomasterfrom
ib/json-cleanup
Apr 1, 2026
Merged

chore(json): Typing improvements#9641
ibgreen merged 16 commits intomasterfrom
ib/json-cleanup

Conversation

@ibgreen-openai
Copy link
Copy Markdown
Collaborator

@ibgreen-openai ibgreen-openai commented May 21, 2025

Summary

This PR cleans up the JSON module API to make JSONConfiguration simpler and more type-safe, updates internal callers to the new shape, and expands tests/docs to cover the new behavior.

Compared to master, this PR:

  • simplifies JSONConfiguration around a single plain-object API
  • makes JSON configuration hooks explicit and typed
  • removes legacy/deprecated configuration patterns from internal usage
  • updates JSON tests and docs to match the new API
  • fixes a brittle data-filter test assertion that was failing in full-suite runs

What Changed

JSON API cleanup

  • Refactored JSONConfiguration to accept one typed config object instead of mixed or variadic forms.
  • Added explicit typed support for runtime hooks:
    • convertFunction
    • preProcessClassProps
    • postProcessConvertedJson
  • Kept data config under the config bag while preserving hook behavior across merges/cloning.
  • Made merge() operate on the same plain-object config shape as the constructor.
  • Updated JSONConverter.mergeConfiguration() to accept plain config objects again.

Internal call sites

  • Updated in-repo callers to the new configuration shape.
  • Removed remaining internal reliance on deprecated constructor patterns.
  • Kept Jupyter playground JSON configuration merging working with plain objects.

Tests

  • Added regression coverage for:
    • plain-object JSONConfiguration construction and merging
    • JSONConverter.mergeConfiguration() with plain objects
    • hook preservation across merges/clones
    • hook execution during conversion
    • JSONLayer configuration override behavior
  • Resolved merge-conflict fallout in JSON tests.
  • Fixed a brittle assertion in test/modules/extensions/data-filter.spec.ts to validate only initialized attribute values.

Docs

  • Updated JSON API docs to describe the cleaned-up single-object configuration model.
  • Updated docs/examples to use classes and the supported hook fields.
  • Added TSDoc across the JSON runtime surface for exported types, classes, functions, props, and fields.

Notes

This intentionally favors a cleaner internal/API model over backward compatibility for older external JSON configuration patterns. The in-repo behavior is preserved and now covered by tests.

Validation

yarn build
yarn test
yarn lint

@coveralls
Copy link
Copy Markdown

coveralls commented May 21, 2025

Coverage Status

coverage: 80.359% (+0.02%) from 80.339%
when pulling 1dfb76f on ib/json-cleanup
into 8a019c8 on master.

@ibgreen ibgreen marked this pull request as ready for review May 26, 2025 11:57
Copy link
Copy Markdown
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

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

Nice cleanups and typings. Left a small comment/question.

What is the perf increase coming from? By removing validate? Edit: I misread "prep" for "perf"

Comment thread modules/json/src/json-configuration.ts Outdated
@@ -34,24 +49,13 @@ export default class JSONConfiguration {
merge(configuration) {
for (const key in configuration) {
switch (key) {
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.

Is the switch necessary?

Comment thread modules/json/src/json-configuration.ts Outdated
@ibgreen ibgreen added this to the v9.2 milestone Jul 13, 2025
@ibgreen ibgreen modified the milestones: v9.2, v9.3 Oct 17, 2025
@chrisgervang chrisgervang mentioned this pull request Feb 3, 2026
31 tasks
@ibgreen ibgreen merged commit 54ebfc6 into master Apr 1, 2026
5 checks passed
@ibgreen ibgreen deleted the ib/json-cleanup branch April 1, 2026 13:26
@ibgreen ibgreen mentioned this pull request May 2, 2026
44 tasks
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.

4 participants