Adds JSON form field support (PP-4438)#224
Conversation
|
Claude finished @tdilauro's task in 5m 42s —— View job Code Review
SummaryThis is a well-constructed addition. The render-phase state sync pattern (replacing DetailsMinor:
|
Fair point. However, the suggested change will not work. Or, more to the point, it won't produce the desired result, which would be to display the "Copy failed" message so that the user knows that something went wrong. It will just fail silently. I fixed this and actually made the code a little more readable in the process. Also addressed the other minor / nit issues raised in the initial AI review. This is ready for human review now. |
## Description Adds a `json` form field type for integration settings. Fields annotated with `FormFieldType.JSON` display a textarea in the admin UI that accepts a JSON value. Two-way handling is wired up automatically: - **Form rendering**: the field's default value is serialized to a JSON string so the UI displays it correctly. - **Form submission**: the incoming string is parsed back to a Python value before Pydantic validation runs, with a clear error message if the input is not valid JSON. **Note**: The ability to edit this field type depends on new support introduced on [circulation-admin PR #224](ThePalaceProject/circulation-admin#224). ## Motivation and Context Integration settings that need to store structured data (objects, arrays) previously had no native form type. This adds a first-class JSON field type that makes the round-trip between the admin UI and the settings model transparent. [Jira PP-4438] ## How Has This Been Tested? - Manual testing in local development environment admin UI. - New/updated tests for the new functionality. - All tests and checks pass locally. - [CI tests](https://github.com/ThePalaceProject/circulation/actions/runs/26350026007) and checks pass. ## Checklist - N/A - I have updated the documentation accordingly. - [x] All new and existing tests passed.
Description
Adds a new
JsonFieldform component for editing JSON-typed protocol settings. The field renders as atextareawith:Note: This field is activated by the new
FormFieldType.JSONsettings field type introduced on circulation PR #3386.Motivation and Context
Allows admins to actively validate JSON in place without submitting the form.
[Jira PP-4438]
How Has This Been Tested?
Checklist: