bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.56k stars 329 forks source link

Shift operation in Jolt is not working for remote spec json #1113

Open gauraverma1990 opened 2 years ago

gauraverma1990 commented 2 years ago

I am using Apache Jolt with Apache Camel in my SpringBoot project to transform Json and it is working fine when I am putting the spec json file in my local under resources folder. But jolt is returning null when I am putting the spec json file on cloud and using its url. I also validated the spec in http://jolt-demo.appspot.com/ it is giving correct results.

Working Code:

from(rabbitmqUri) .transform(body().convertTo(String.class)) .to("jolt:/specs/securecx-to-pragma-spec.json?inputType=JsonString&outputType=JsonString") Not Working Code:

from(rabbitmqUri) .transform(body().convertTo(String.class)) .to("jolt:http://storage.googleapis.com/asia.artifacts.apigee-sample-2021.appspot.com/specs/securecxToPragmaSpec.json?inputType=JsonString&outputType=JsonString")

Input Json: { "ssoId": "bob@cnx.com", "violationType": "phone", "violationMessageTitle": "phone detected", "violationMessageDesc": "phone detected at back" }

Expected Json:

{ "ssoId" : "bob@cnx.com", "messageDetails" : { "title" : "phone detected", "desc" : "phone detected at back" } }

Current Behavior: Conversion is not happening and also there is no exception in logs.

Spec Used:

[ { "operation": "shift", "spec": { "ssoId": "ssoId", "violationMessageTitle": "messageDetails.title", "violationMessageDesc": "messageDetails.desc" } } ]

Please help in identifying the cause and suggest the solution.

kubilayeksioglu commented 2 years ago

@gauraverma1990 This looks like an issue on the Camel end, rather than the JOLT, I don't think Jolt has a remote loading functionality. I'd recommend opening up the issue there instead of here.