[Repo Assist] fix(config): render JSON object editor for object-typed schema fields#679
Conversation
Fixes #655 Object-typed schema fields without fixed 'properties' (such as the 'headers' field on embedding providers) previously fell through to the string editor, which staged their values as plain text strings rather than JSON objects. This caused the UI to pass an incorrect string value to the gateway when saving provider headers like {"api-key": "..."}. Add RenderJsonObjectField alongside the existing RenderJsonArrayField: - Renders a multi-line Consolas TextBox pre-populated with the current JSON object value (or '{}' as the placeholder). - Parses and validates JSON on each change; only stages a value when the input is a valid JSON object. - Shows a validation error in the field's error block when the input is not a valid JSON object. - Dispatches ConfigChanged with validation errors so the Save button stays disabled until the value is corrected. Add a dispatch branch in RenderField to route 'object' type fields through RenderJsonObjectField before the string fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: needs maintainer review before merge. Reviewed June 3, 2026, 9:56 PM ET / 01:56 UTC. Summary Reproducibility: yes. Source inspection shows object-typed schema fields without fixed Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow object-field editor after adding real WinUI proof for the headers edit/save path and completing the required Windows build and test validation. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows object-typed schema fields without fixed Is this the best way to solve the issue? Yes, with evidence still pending. A generic JSON object editor in AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 85445c78066b. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Closes #655
Object-typed schema fields without fixed
properties(such as theheadersfield on embedding providers like Azure Foundry) previously fell through to the string editor inSchemaConfigEditor. This caused the UI to stage and save a string value instead of a JSON object, silently corrupting the provider configuration.Root Cause
RenderFieldinSchemaConfigEditor.xaml.cshandlesenum,boolean,number,integer, andarraytypes explicitly, then falls through to the string editor for everything else — includingobjecttype fields. When a user entered{"api-key": "value"}into the string editor, the value was staged as the literal string"{\"api-key\": \"value\"}"rather than as a JSON object, which would be rejected or misinterpreted by the gateway.Fix
Add a
RenderJsonObjectFieldmethod (modelled on the existingRenderJsonArrayField) and dispatchobject-typed fields to it inRenderField:ConsolasTextBox pre-populated with the current JSON object value (or{}as the empty placeholder).Trade-offs
RenderJsonArrayFieldapproach for complex array items, and avoids the complexity of a dynamic row editor with unknown key types.propertiescontinue to render as expandable sections (unchangedRenderObjectSectionpath).Test Status
RenderJsonObjectFieldmethod using the same API surface already present inRenderJsonArrayField, so no new Windows-only issues are introduced.