Skip to content

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

Open
tomerqodo wants to merge 5 commits intoqodo_claude_vs_qodo_base_fixweb_enable_json_object_type_support_in_console_ui_pr2from
qodo_claude_vs_qodo_head_fixweb_enable_json_object_type_support_in_console_ui_pr2
Open

fix(web): enable JSON_OBJECT type support in console UI#153
tomerqodo wants to merge 5 commits intoqodo_claude_vs_qodo_base_fixweb_enable_json_object_type_support_in_console_ui_pr2from
qodo_claude_vs_qodo_head_fixweb_enable_json_object_type_support_in_console_ui_pr2

Conversation

@tomerqodo
Copy link

Benchmark PR from agentic-review-benchmarks#2

@qodo-code-review
Copy link

Review Summary by Qodo

Fix JSON_OBJECT type support and schema validation in console UI

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Fixed JSON_OBJECT type support by correcting schema structure handling
• Removed automatic schema wrapping to accept full JSON schema objects
• Added validation for JSON schema format and object type requirement
• Updated JSON schema placeholder to demonstrate correct structure
• Added comprehensive error messages across 24 language translations
Diagram
flowchart LR
  A["JSON Schema Input"] --> B["Validation Logic"]
  B --> C["Check if Empty"]
  C -->|Empty| D["Set to undefined"]
  C -->|Not Empty| E["Parse JSON"]
  E --> F["Verify Type is object"]
  F -->|Valid| G["Save Schema"]
  F -->|Invalid| H["Show Error Message"]
  D --> I["Payload Saved"]
  G --> I
Loading

Grey Divider

File Changes

1. web/app/components/app/configuration/config-var/config-modal/config.ts 🐞 Bug fix +15/-10

Updated JSON schema placeholder structure

web/app/components/app/configuration/config-var/config-modal/config.ts


2. web/app/components/app/configuration/config-var/config-modal/index.tsx 🐞 Bug fix +51/-13

Fixed JSON schema handling and validation logic

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


3. web/i18n/ar-TN/app-debug.json 📝 Documentation +2/-0

Added Arabic error messages for JSON schema

web/i18n/ar-TN/app-debug.json


View more (21)
4. web/i18n/de-DE/app-debug.json 📝 Documentation +2/-0

Added German error messages for JSON schema

web/i18n/de-DE/app-debug.json


5. web/i18n/en-US/app-debug.json 📝 Documentation +2/-0

Added English error messages for JSON schema

web/i18n/en-US/app-debug.json


6. web/i18n/es-ES/app-debug.json 📝 Documentation +2/-0

Added Spanish error messages for JSON schema

web/i18n/es-ES/app-debug.json


7. web/i18n/fa-IR/app-debug.json 📝 Documentation +2/-0

Added Persian error messages for JSON schema

web/i18n/fa-IR/app-debug.json


8. web/i18n/fr-FR/app-debug.json 📝 Documentation +2/-0

Added French error messages for JSON schema

web/i18n/fr-FR/app-debug.json


9. web/i18n/hi-IN/app-debug.json 📝 Documentation +2/-0

Added Hindi error messages for JSON schema

web/i18n/hi-IN/app-debug.json


10. web/i18n/id-ID/app-debug.json 📝 Documentation +2/-0

Added Indonesian error messages for JSON schema

web/i18n/id-ID/app-debug.json


11. web/i18n/it-IT/app-debug.json 📝 Documentation +2/-0

Added Italian error messages for JSON schema

web/i18n/it-IT/app-debug.json


12. web/i18n/ja-JP/app-debug.json 📝 Documentation +2/-0

Added Japanese error messages for JSON schema

web/i18n/ja-JP/app-debug.json


13. web/i18n/ko-KR/app-debug.json 📝 Documentation +2/-0

Added Korean error messages for JSON schema

web/i18n/ko-KR/app-debug.json


14. web/i18n/pl-PL/app-debug.json 📝 Documentation +2/-0

Added Polish error messages for JSON schema

web/i18n/pl-PL/app-debug.json


15. web/i18n/pt-BR/app-debug.json 📝 Documentation +2/-0

Added Portuguese error messages for JSON schema

web/i18n/pt-BR/app-debug.json


16. web/i18n/ro-RO/app-debug.json 📝 Documentation +2/-0

Added Romanian error messages for JSON schema

web/i18n/ro-RO/app-debug.json


17. web/i18n/ru-RU/app-debug.json 📝 Documentation +2/-0

Added Russian error messages for JSON schema

web/i18n/ru-RU/app-debug.json


18. web/i18n/sl-SI/app-debug.json 📝 Documentation +2/-0

Added Slovenian error messages for JSON schema

web/i18n/sl-SI/app-debug.json


19. web/i18n/th-TH/app-debug.json 📝 Documentation +2/-0

Added Thai error messages for JSON schema

web/i18n/th-TH/app-debug.json


20. web/i18n/tr-TR/app-debug.json 📝 Documentation +2/-0

Added Turkish error messages for JSON schema

web/i18n/tr-TR/app-debug.json


21. web/i18n/uk-UA/app-debug.json 📝 Documentation +2/-0

Added Ukrainian error messages for JSON schema

web/i18n/uk-UA/app-debug.json


22. web/i18n/vi-VN/app-debug.json 📝 Documentation +2/-0

Added Vietnamese error messages for JSON schema

web/i18n/vi-VN/app-debug.json


23. web/i18n/zh-Hans/app-debug.json 📝 Documentation +2/-0

Added Simplified Chinese error messages for JSON schema

web/i18n/zh-Hans/app-debug.json


24. web/i18n/zh-Hant/app-debug.json 📝 Documentation +2/-0

Added Traditional Chinese error messages for JSON schema

web/i18n/zh-Hant/app-debug.json


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 10, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

1. return True breaks TypeScript 📘 Rule violation ✓ Correctness
Description
The function returns True (Python-style) instead of TypeScript true, which will cause a
runtime/compile error under strict TypeScript compilation. This can break the JSON schema editing
flow in the config modal.
Code

web/app/components/app/configuration/config-var/config-modal/index.tsx[139]

+      return True
Evidence
PR Compliance ID 11 requires strict TypeScript compilation; True is not a valid boolean literal in
TypeScript and will fail compilation. The added line explicitly returns True.

AGENTS.md
web/app/components/app/configuration/config-var/config-modal/index.tsx[139-139]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeScript code returns `True` (invalid identifier) instead of `true`, which breaks strict compilation.

## Issue Context
This occurs in the `handleJSONSchemaChange` callback in the config modal.

## Fix Focus Areas
- web/app/components/app/configuration/config-var/config-modal/index.tsx[136-142]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Dead store v variable 📘 Rule violation ⛯ Reliability
Description
A parsed JSON value is assigned to v but never used, which violates configured maintainability
rules and may fail linting/quality gates. This adds unnecessary code and can trigger SonarJS
no-dead-store errors.
Code

web/app/components/app/configuration/config-var/config-modal/index.tsx[137]

      const v = JSON.parse(value)
-      const res = {
-        ...jsonObjectWrap,
-        properties: v,
-      }
-      handlePayloadChange('json_schema')(JSON.stringify(res, null, 2))
Evidence
PR Compliance ID 16 requires compliance with SonarJS rules including no-dead-store; the added
const v = JSON.parse(value) is a dead store because v is not referenced afterward.

AGENTS.md
web/app/components/app/configuration/config-var/config-modal/index.tsx[137-137]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`const v = JSON.parse(value)` is introduced but `v` is never used, which can violate SonarJS `no-dead-store` and other lint rules.

## Issue Context
The code appears to parse only to validate JSON; it can parse without storing the result.

## Fix Focus Areas
- web/app/components/app/configuration/config-var/config-modal/index.tsx[136-140]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Stale jsonSchemaStr memo 🐞 Bug ✓ Correctness
Description
jsonSchemaStr’s useMemo reads type but only depends on tempPayload.json_schema, so it can
return a value computed under an old type. This can show an empty schema editor when switching to
jsonObject while an existing json_schema string is already present.
Code

web/app/components/app/configuration/config-var/config-modal/index.tsx[R81-89]

  const jsonSchemaStr = useMemo(() => {
    const isJsonObject = type === InputVarType.jsonObject
    if (!isJsonObject || !tempPayload.json_schema)
      return ''
    try {
-      return JSON.stringify(JSON.parse(tempPayload.json_schema).properties, null, 2)
+      return JSON.stringify(JSON.parse(tempPayload.json_schema), null, 2)
    }
    catch {
      return ''
Evidence
The memo’s result is reused whenever tempPayload.json_schema is unchanged, even if type changes;
and handleTypeChange changes draft.type without clearing json_schema, making it possible for
type to change while the memo doesn’t recompute.

web/app/components/app/configuration/config-var/config-modal/index.tsx[81-91]
web/app/components/app/configuration/config-var/config-modal/index.tsx[187-205]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`jsonSchemaStr` uses `type` but does not include it in the `useMemo` dependency list, allowing stale memoized values when `type` changes without `json_schema` changing.

### Issue Context
`handleTypeChange` updates `tempPayload.type` without clearing `json_schema`, so the missing dependency is observable in the UI.

### Fix Focus Areas
- web/app/components/app/configuration/config-var/config-modal/index.tsx[81-91]
- web/app/components/app/configuration/config-var/config-modal/index.tsx[187-205]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

}
handlePayloadChange('json_schema')(JSON.stringify(res, null, 2))
handlePayloadChange('json_schema')(value)
return True

Choose a reason for hiding this comment

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

Action required

1. return true breaks typescript 📘 Rule violation ✓ Correctness

The function returns True (Python-style) instead of TypeScript true, which will cause a
runtime/compile error under strict TypeScript compilation. This can break the JSON schema editing
flow in the config modal.
Agent Prompt
## Issue description
TypeScript code returns `True` (invalid identifier) instead of `true`, which breaks strict compilation.

## Issue Context
This occurs in the `handleJSONSchemaChange` callback in the config modal.

## Fix Focus Areas
- web/app/components/app/configuration/config-var/config-modal/index.tsx[136-142]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

return null
}
try {
const v = JSON.parse(value)

Choose a reason for hiding this comment

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

Action required

2. Dead store v variable 📘 Rule violation ⛯ Reliability

A parsed JSON value is assigned to v but never used, which violates configured maintainability
rules and may fail linting/quality gates. This adds unnecessary code and can trigger SonarJS
no-dead-store errors.
Agent Prompt
## Issue description
`const v = JSON.parse(value)` is introduced but `v` is never used, which can violate SonarJS `no-dead-store` and other lint rules.

## Issue Context
The code appears to parse only to validate JSON; it can parse without storing the result.

## Fix Focus Areas
- web/app/components/app/configuration/config-var/config-modal/index.tsx[136-140]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 81 to 89
const jsonSchemaStr = useMemo(() => {
const isJsonObject = type === InputVarType.jsonObject
if (!isJsonObject || !tempPayload.json_schema)
return ''
try {
return JSON.stringify(JSON.parse(tempPayload.json_schema).properties, null, 2)
return JSON.stringify(JSON.parse(tempPayload.json_schema), null, 2)
}
catch {
return ''

Choose a reason for hiding this comment

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

Remediation recommended

3. Stale jsonschemastr memo 🐞 Bug ✓ Correctness

jsonSchemaStr’s useMemo reads type but only depends on tempPayload.json_schema, so it can
return a value computed under an old type. This can show an empty schema editor when switching to
jsonObject while an existing json_schema string is already present.
Agent Prompt
### Issue description
`jsonSchemaStr` uses `type` but does not include it in the `useMemo` dependency list, allowing stale memoized values when `type` changes without `json_schema` changing.

### Issue Context
`handleTypeChange` updates `tempPayload.type` without clearing `json_schema`, so the missing dependency is observable in the UI.

### Fix Focus Areas
- web/app/components/app/configuration/config-var/config-modal/index.tsx[81-91]
- web/app/components/app/configuration/config-var/config-modal/index.tsx[187-205]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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