Skip to content

PathNode evaluate() should build configuration using passed in mappingProvider #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ajaymandvekar opened this issue Mar 25, 2021 · 1 comment

Comments

@ajaymandvekar
Copy link

ajaymandvekar commented Mar 25, 2021

The PathNode->Evaluate() func builds configuration without using the passed in ctx->mappingProvider.
It leads the configuration to fallback to default mappingProvider. This doesn't seem to cause any issue when used with Jackson providers but with Gson it leads to use Jackson Mapping provider if defaults are not set statically.

Solution:

Replace

Configuration c = Configuration.builder().jsonProvider(ctx.configuration().jsonProvider()).options(Option.REQUIRE_PROPERTIES).build();

with

Configuration c = Configuration.builder().jsonProvider(ctx.configuration().jsonProvider()).mappingProvider(ctx.configuration().mappingProvider()).options(Option.REQUIRE_PROPERTIES).build();

NOTE:
This is a problem when json-smart is completely excluded and Gson is used as the sole provider and mapper.

@uschindler
Copy link

Hi we also see this problem if you only use GSON and exclude json-smart.

IMHO, the whole json-smart dependency should be optional and all occurences of "net.minidev" should be nuked from code.

mkr added a commit to mkr/JsonPath that referenced this issue Apr 13, 2023
…lso related to json-path#682, json-path#676, json-path#513, json-path#252)

* Replace hard-coded json-smart parser with one retrieved from context (where available) or default configuration.
* This enables a project to _exclude_ the transitive json-smart dependency when setting an alternative default configuration.
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

No branches or pull requests

2 participants