Skip to content

Comments

fix(web): enable JSON_OBJECT type support in console UI#15

Open
tomerqodo wants to merge 5 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base_fixweb_enable_json_object_type_support_in_console_ui_pr439from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head_fixweb_enable_json_object_type_support_in_console_ui_pr439
Open

fix(web): enable JSON_OBJECT type support in console UI#15
tomerqodo wants to merge 5 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base_fixweb_enable_json_object_type_support_in_console_ui_pr439from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head_fixweb_enable_json_object_type_support_in_console_ui_pr439

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 22, 2026

Benchmark PR from qodo-benchmark#439

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced JSON schema validation with specific error messages for invalid schemas and non-object types.
  • Localization

    • Added localized error messages for JSON schema validation across 22 language variants, improving clarity for international users when validation fails.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

This PR refactors JSON schema handling in the config modal component by consolidating the JSON placeholder structure, removing the isSupportJSON dependency, and adding validation for JSON schemas. New error messages are introduced across 22 language files to support schema validation feedback.

Changes

Cohort / File(s) Summary
JSON Schema Configuration
web/app/components/app/configuration/config-var/config-modal/config.ts, web/app/components/app/configuration/config-var/config-modal/index.tsx
Restructured JSON schema placeholder from top-level properties to nested object structure. Removed isSupportJSON flag dependency. Introduced isJsonSchemaEmpty utility for detecting empty schemas. Enhanced handleConfirm with schema validation (ensures valid JSON and object type) via payloadToSave across all branches. JSON schema now parsed as whole object instead of extracting properties. Empty schemas are normalized and omitted from saved payloads.
Internationalization (22 languages)
web/i18n/{ar-TN,de-DE,en-US,es-ES,fa-IR,fr-FR,hi-IN,id-ID,it-IT,ja-JP,ko-KR,pl-PL,pt-BR,ro-RO,ru-RU,sl-SI,th-TH,tr-TR,uk-UA,vi-VN,zh-Hans,zh-Hant}/app-debug.json
Added two new error message keys under variableConfig.errorMsg: jsonSchemaInvalid and jsonSchemaMustBeObject with localized translations for each language. No changes to existing keys.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A config schema refined with care,
Validating JSON everywhere,
Objects nested, errors caught,
Twenty tongues with messages taught,
Structure strengthened, logic fair!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and does not follow the required template structure, missing critical sections like Summary, Screenshots, issue links, and contribution checklist. Complete the PR description by filling in the required template sections including a proper summary of changes, linked issue reference (Fixes #), screenshots if applicable, and checked checklist items.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling JSON_OBJECT type support in the console UI web component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@web/app/components/app/configuration/config-var/config-modal/index.tsx`:
- Around line 131-140: The return value in the JSON parse branch uses the
Python-style identifier "True" which is undefined in JS/TS; update the return
statement in the function handling the json_schema field (the branch that parses
value with JSON.parse and calls handlePayloadChange('json_schema')) to return
the boolean literal true instead of True, and ensure the function's return type
matches a boolean or null as intended (check the uses of isEmpty and
handlePayloadChange to confirm expected type).
🧹 Nitpick comments (1)
web/app/components/app/configuration/config-var/config-modal/index.tsx (1)

81-91: Add type to the useMemo deps to avoid stale schema text.
When users toggle from a non-JSON type back to jsonObject, jsonSchemaStr can remain cached as empty because type isn’t a dependency.

♻️ Suggested fix
-  }, [tempPayload.json_schema])
+  }, [tempPayload.json_schema, type])
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ee16f2 and a54737d.

📒 Files selected for processing (24)
  • web/app/components/app/configuration/config-var/config-modal/config.ts
  • web/app/components/app/configuration/config-var/config-modal/index.tsx
  • web/i18n/ar-TN/app-debug.json
  • web/i18n/de-DE/app-debug.json
  • web/i18n/en-US/app-debug.json
  • web/i18n/es-ES/app-debug.json
  • web/i18n/fa-IR/app-debug.json
  • web/i18n/fr-FR/app-debug.json
  • web/i18n/hi-IN/app-debug.json
  • web/i18n/id-ID/app-debug.json
  • web/i18n/it-IT/app-debug.json
  • web/i18n/ja-JP/app-debug.json
  • web/i18n/ko-KR/app-debug.json
  • web/i18n/pl-PL/app-debug.json
  • web/i18n/pt-BR/app-debug.json
  • web/i18n/ro-RO/app-debug.json
  • web/i18n/ru-RU/app-debug.json
  • web/i18n/sl-SI/app-debug.json
  • web/i18n/th-TH/app-debug.json
  • web/i18n/tr-TR/app-debug.json
  • web/i18n/uk-UA/app-debug.json
  • web/i18n/vi-VN/app-debug.json
  • web/i18n/zh-Hans/app-debug.json
  • web/i18n/zh-Hant/app-debug.json
🧰 Additional context used
🧬 Code graph analysis (1)
web/app/components/app/configuration/config-var/config-modal/index.tsx (1)
web/scripts/auto-gen-i18n.js (1)
  • trimmed (149-149)
🔇 Additional comments (25)
web/i18n/pl-PL/app-debug.json (1)

309-310: LGTM — translations are clear and consistent.

web/i18n/pt-BR/app-debug.json (1)

309-310: LGTM — translations read well and match the new validation messages.

web/i18n/ro-RO/app-debug.json (1)

309-310: Translations look good.

Clear, user‑friendly error messages consistent with JSON Schema validation context.

web/i18n/zh-Hant/app-debug.json (1)

309-310: LGTM!

The new i18n entries for JSON Schema validation error messages are correctly implemented:

  • Keys follow the existing variableConfig.errorMsg.* naming convention.
  • Traditional Chinese translations are accurate and use proper punctuation (「」for quoted terms).
  • JSON syntax is valid.
web/i18n/uk-UA/app-debug.json (1)

309-310: LGTM!

The new Ukrainian translation keys for JSON Schema validation errors are correctly formatted and follow the existing naming conventions. The translations are grammatically appropriate, and the escaped quotes in jsonSchemaMustBeObject are properly handled.

web/i18n/th-TH/app-debug.json (1)

309-310: LGTM!

The new Thai translations for JSON Schema validation error messages are correctly added. The keys follow the existing naming convention, the JSON syntax is valid with properly escaped quotes, and the translations accurately convey the intended validation feedback.

web/i18n/ru-RU/app-debug.json (1)

309-310: LGTM!

The new Russian localization entries for JSON Schema validation errors are well-formed and consistent with the existing structure.

web/i18n/ar-TN/app-debug.json (1)

309-310: LGTM!

The Arabic localization entries are correctly formatted and consistent with the PR's changes across other locales.

web/i18n/en-US/app-debug.json (1)

309-310: LGTM!

The base English localization entries for JSON Schema validation are clear and appropriately descriptive for the validation scenarios.

web/i18n/vi-VN/app-debug.json (1)

309-310: LGTM!

The Vietnamese localization entries are correctly formatted and consistent with the changes across other locales.

web/i18n/tr-TR/app-debug.json (1)

309-310: LGTM!

The Turkish localization entries are correctly formatted with appropriate translations.

web/i18n/fa-IR/app-debug.json (1)

309-310: LGTM!

The Persian (Farsi) localization entries are correctly formatted and consistent with the PR's changes.

web/i18n/it-IT/app-debug.json (1)

309-310: LGTM — Italian JSON schema validation messages added.
Strings are clear and aligned with the new validation rules.

web/i18n/sl-SI/app-debug.json (1)

309-310: LGTM — Slovenian JSON schema validation messages added.
No issues found with the new strings.

web/i18n/de-DE/app-debug.json (1)

309-310: LGTM — German JSON schema validation messages added.
Looks consistent with the validation behavior.

web/i18n/hi-IN/app-debug.json (1)

309-310: LGTM — Hindi JSON schema validation messages added.
Strings align with the new validation flow.

web/i18n/ko-KR/app-debug.json (1)

309-310: LGTM — Korean JSON schema validation messages added.
No issues with the new localized strings.

web/i18n/zh-Hans/app-debug.json (1)

309-310: LGTM — Simplified Chinese JSON schema validation messages added.
Clear and consistent with the new validation rules.

web/i18n/fr-FR/app-debug.json (1)

309-310: LGTM — FR validation strings added.
These additions match the new JSON schema validation flow.

web/i18n/ja-JP/app-debug.json (1)

309-310: LGTM — JA validation strings added.
These additions match the new JSON schema validation flow.

web/app/components/app/configuration/config-var/config-modal/config.ts (1)

8-27: LGTM — placeholder schema consolidated correctly.
The JSON Schema placeholder now reflects an object-based schema as intended.

web/i18n/id-ID/app-debug.json (1)

309-310: LGTM — ID validation strings added.
These additions match the new JSON schema validation flow.

web/i18n/es-ES/app-debug.json (1)

309-310: LGTM — ES validation strings added.
These additions match the new JSON schema validation flow.

web/app/components/app/configuration/config-var/config-modal/index.tsx (2)

179-184: LGTM — JSON option gating looks correct for non-basic apps.
This simplifies the selection logic while keeping the JSON type behind the app mode gate.


237-327: LGTM — json_schema normalization and validation are solid.
Dropping empty json_schema and validating object-type schemas should improve UX and data hygiene.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +131 to 140
const isEmpty = value == null || value.trim() === ''
if (isEmpty) {
handlePayloadChange('json_schema')(undefined)
return null
}
try {
const v = JSON.parse(value)
const res = {
...jsonObjectWrap,
properties: v,
}
handlePayloadChange('json_schema')(JSON.stringify(res, null, 2))
handlePayloadChange('json_schema')(value)
return True
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix Truetrue (build/runtime breaker).
Line 139 uses True, which is undefined in TS/JS and will fail compilation or throw at runtime.

🐛 Proposed fix
-      return True
+      return true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isEmpty = value == null || value.trim() === ''
if (isEmpty) {
handlePayloadChange('json_schema')(undefined)
return null
}
try {
const v = JSON.parse(value)
const res = {
...jsonObjectWrap,
properties: v,
}
handlePayloadChange('json_schema')(JSON.stringify(res, null, 2))
handlePayloadChange('json_schema')(value)
return True
}
const isEmpty = value == null || value.trim() === ''
if (isEmpty) {
handlePayloadChange('json_schema')(undefined)
return null
}
try {
const v = JSON.parse(value)
handlePayloadChange('json_schema')(value)
return true
}
🤖 Prompt for AI Agents
In `@web/app/components/app/configuration/config-var/config-modal/index.tsx`
around lines 131 - 140, The return value in the JSON parse branch uses the
Python-style identifier "True" which is undefined in JS/TS; update the return
statement in the function handling the json_schema field (the branch that parses
value with JSON.parse and calls handlePayloadChange('json_schema')) to return
the boolean literal true instead of True, and ensure the function's return type
matches a boolean or null as intended (check the uses of isEmpty and
handlePayloadChange to confirm expected type).

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.

2 participants