WW-4858 Cover nested-leaf accepted-name and include patterns in JSON filtering#1783
Merged
Merged
Conversation
Add two tests to JSONInterceptorTest exercising the nested-object path for the name/value filtering added in WW-4858: - testAcceptedNamePatternRejectsNestedKey: accepted name patterns are raw full-match regexes with no hierarchy expansion, so the intermediate node ("bean") must itself match an accepted pattern or the whole subtree is dropped before the leaf is visited. - testIncludePropertiesAppliedToNestedInputWhenEnabled: include patterns do expand across the hierarchy, so "bean.stringField" also matches the intermediate "bean" and the nested leaf populates while the excluded sibling "bean.intField" is dropped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes WW-4858
What & why
Follow-up test coverage for the JSON parameter-filtering work in #1773. That PR
tested the flat-key cases and a nested excluded name pattern, but left the
nested-leaf behaviour of accepted-name and include patterns uncovered.
These two paths behave differently through
JSONInterceptor's recursivetree-walk, and the difference is easy to regress silently:
AcceptedPatternsChecker) are raw full-matchregexes with no hierarchy expansion. The intermediate node (
bean) mustitself match an accepted pattern, otherwise the entire subtree is dropped
before the leaf (
bean.stringField) is ever visited.includeProperties, viaJSONUtil.processIncludePatterns)do expand across the hierarchy:
bean.stringFieldcompiles patterns forboth the intermediate
beanand the leaf, so the nested leaf populates whilethe excluded sibling
bean.intFieldis dropped.Tests added (
JSONInterceptorTest)testAcceptedNamePatternRejectsNestedKeytestIncludePropertiesAppliedToNestedInputWhenEnabledBoth document the intermediate-node semantics in comments so the divergence is
explicit rather than surprising.
Testing
mvn test -pl plugins/json -DskipAssembly -Dtest=JSONInterceptorTest— 40 tests, all pass.🤖 Generated with Claude Code