Reputation: 3
I'm having trouble using the dataweave library in Java.
I have a DW script that I need to receive a payload file (as application/json
) and another parameter (as application/yaml
) something like the following example:
%dw 2.0
input payload application/json
input parameters application/yaml
output application/json
---
{ input1: payload, input2: parameters }
This script with both input file in playground runs OK but when I try to do this with Java lib. It is something like this:
final ScriptingBindings bindings = new ScriptingBindings()
.addBinding("payload", input1, "application/json", new HashMap<>())
.addBinding("parameter", input2, "application/yaml", new HashMap<>());
var result = compiledExpression.write(bindings);
It does not work and in the error it appears that application/yaml
is not supported but in the documentation it says yes and in the playground it does not present problems either. Is this message true or am I misusing the library?
Unknown content type `application/yaml`. Supported content types are: `application/dw`, `application/json`, `application/xml`, `application/csv`, `application/octet-stream`, `text/plain`, `application/x-www-form-urlencoded`, `multipart/form-data`, `text/x-java-properties`, `application/java`
Upvotes: 0
Views: 307
Reputation: 5059
You need to add the yaml-module to your dependencies in your project and it will be available for you.
Upvotes: 1