Skip to content

Unwrap scalar function arguments before type conversion - #1089

Open
JimmyLiuJia wants to merge 1 commit into
json-path:masterfrom
JimmyLiuJia:fix/function-scalar-literals
Open

JimmyLiuJia wants to merge 1 commit into
json-path:masterfrom
JimmyLiuJia:fix/function-scalar-literals

Conversation

@JimmyLiuJia

Copy link
Copy Markdown

Fixes #1070.

String and numeric function literals remain wrapped values with Gson and the Jackson 2/3 JsonNode providers. concat($.one, "-", $.two) therefore returns one"-"two, while avg(1, 2) and index(1) discard their numeric arguments. Unwrap values at the argument consumption boundary before checking their type.

The regressions compile a separate query for each provider, avoiding reuse of another provider's cached function arguments, and include the original Jackson ReadContext example. Array parameters, boolean/null handling and appended JSON structures retain their existing behaviour.

Validation on Java 17 and 21 with Gradle 8.5: build --warning-mode all, check and clean publishToMavenLocal all pass. Each JDK's two-module suite runs 1,109 tests: 1,096 pass, 13 existing skips, no failures or errors. The same 83 regression cases have 13 failures on the original production source and all pass with this change, with no skips.

Scalar literal cases cover the seven providers that can parse scalar roots; array and structure cases cover all eight configurations. JSON-P's existing scalar-root parsing limitation is outside this fix.

This branch has not been deployed

No deployments
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.

Q: How to use constant in json path?

1 participant