Introduce a new OpenAPI response visibility feature based on x-display, including schema-aware filtering with $ref support and validation guardrails for required-field checks on hidden paths.
- Bug fix
- New feature
- Breaking change
- Documentation update
- Refactoring
N/A
- Updated:
core/plugin/link/utils/open_api_schema/response_filter.py - Added schema-driven
x-displayresponse filtering capability for OpenAPI JSON responses. - Implemented recursive traversal with local
$refresolution (#/components/...) for nested/array schemas. - Kept behavior contract explicit:
- Remove fields marked with
x-display: false(supports booleanfalseand string"false"). - If all children under an object/array container are hidden, keep structural type and return empty
{}/[].
- Remove fields marked with
- Added/kept compatibility helpers:
- Hidden path collection (
get_need_be_poped_list). - Validation error ignore decision for hidden required fields (
should_ignore_validation_error_by_x_display).
- Hidden path collection (
- Updated:
core/plugin/link/service/community/tools/http/execution_server.py - Added end-to-end response processing flow for the new feature: validate first, then apply visibility filtering.
- Applied filtering after validation in both request handling and tool debug paths.
- Integrated missing-visible-field detection and hidden-field-aware ignore logic into validation flow.
- Preserved existing exception handling and telemetry behavior.
- Added:
core/plugin/link/tests/unit/test_response_filter.py - Covered scenarios:
- Hidden field removal and parent-hidden precedence for object fields.
- Array container behavior: hide all elements when item schema is
x-display: false. - Keep empty object items in arrays when child fields are hidden.
$ref-based schema resolution in filtering and missing-visible-path checks.- Required-field validation ignore checks for hidden fields.
- New tests added (unit)
- Existing full test suite executed
- Manual testing completed
Test scope added in this PR:
test_filter_parent_hidden_takes_precedencetest_filter_keeps_empty_object_elements_in_arraytest_filter_hides_array_elements_when_items_closedtest_filter_ref_items_closed_hides_all_elementstest_missing_visible_declared_paths_with_ref
- No API contract change in request shape.
- Response payload visibility now supports declarative control via schema
x-display. - Potential behavior change: previously returned hidden fields may now be removed or collapsed to
{}/[]per schema. - Risk is controllable and covered by focused unit tests around nested arrays, refs, and required-field validation edge cases.
If regressions are found:
- Revert
response_filter.pyimplementation to the previous filtering logic. - Revert execution order changes in
execution_server.py.
- Code follows project coding standards
- Self-review completed
- Documentation/comments updated where needed
- No breaking changes introduced