Skip to content

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

Open
tomerqodo wants to merge 5 commits into
copilot_combined_20260121_qodo_grep_cursor_copilot_1_base_fixweb_enable_json_object_type_support_in_console_ui_pr439from
copilot_combined_20260121_qodo_grep_cursor_copilot_1_head_fixweb_enable_json_object_type_support_in_console_ui_pr439
Open

fix(web): enable JSON_OBJECT type support in console UI#51
tomerqodo wants to merge 5 commits into
copilot_combined_20260121_qodo_grep_cursor_copilot_1_base_fixweb_enable_json_object_type_support_in_console_ui_pr439from
copilot_combined_20260121_qodo_grep_cursor_copilot_1_head_fixweb_enable_json_object_type_support_in_console_ui_pr439

Conversation

@tomerqodo

Copy link
Copy Markdown

Benchmark PR from qodo-benchmark#439

Copilot AI review requested due to automatic review settings January 21, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enables JSON_OBJECT type support in the console UI by adding validation for JSON schemas and updating internationalization strings across 23 languages.

Changes:

  • Added JSON schema validation to ensure schemas are valid JSON and have type "object"
  • Updated JSON schema handling to store the complete schema object instead of just properties
  • Added error messages in 23 languages for invalid JSON schemas

Reviewed changes

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

File Description
web/i18n/*/app-debug.json (23 files) Added two new error message keys for JSON schema validation in all supported languages
web/app/components/app/configuration/config-var/config-modal/index.tsx Implemented JSON schema validation, updated schema storage format, and added validation checks in handleConfirm
web/app/components/app/configuration/config-var/config-modal/config.ts Updated placeholder to show complete JSON Schema structure with top-level type field

Comment on lines +310 to +324
else if (type === InputVarType.jsonObject) {
if (!isSchemaEmpty && typeof jsonSchemaValue === 'string') {
try {
const schema = JSON.parse(jsonSchemaValue)
if (schema?.type !== 'object') {
Toast.notify({ type: 'error', message: t('variableConfig.errorMsg.jsonSchemaMustBeObject', { ns: 'appDebug' }) })
return
}
}
catch {
Toast.notify({ type: 'error', message: t('variableConfig.errorMsg.jsonSchemaInvalid', { ns: 'appDebug' }) })
return
}
}
onConfirm(payloadToSave, moreInfo)

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

The new JSON object validation functionality (lines 310-324) and JSON schema handling (lines 131-144, 237-257) are not covered by tests. According to the project's testing guidelines, behavior in new or updated code should have adequate test coverage. The component test file exists at 'web/app/components/app/configuration/config-var/index.spec.tsx', but there are no tests for the jsonObject input type and its validation logic.

Copilot uses AI. Check for mistakes.
const handleConfirm = () => {
const jsonSchemaValue = tempPayload.json_schema
const isSchemaEmpty = isJsonSchemaEmpty(jsonSchemaValue)
const normalizedJsonSchema = isSchemaEmpty ? undefined : jsonSchemaValue

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

The variable 'normalizedJsonSchema' is assigned but never used. It appears to be redundant since the same logic is already applied when creating 'payloadToSave' on line 255-257. This variable should be removed to improve code maintainability.

Suggested change
const normalizedJsonSchema = isSchemaEmpty ? undefined : jsonSchemaValue

Copilot uses AI. Check for mistakes.
}
handlePayloadChange('json_schema')(JSON.stringify(res, null, 2))
handlePayloadChange('json_schema')(value)
return True

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

JavaScript/TypeScript uses lowercase 'true' for the boolean literal, not 'True' (which is Python syntax). This will cause a ReferenceError at runtime since 'True' is not defined.

Suggested change
return True
return true

Copilot uses AI. Check for mistakes.
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.

3 participants