How do I configure snakeyaml to remove the following single quotes?
#%RAML 1.0 DataType
type: object
properties:
apiName:
type: string
label:
type: string
sortable:
type: '!include boolean-types.raml'
I am using snakeyaml to output RAML, I need to remove the single quotes on the include.
I have configured the options as follows:
DumperOptions options = new DumperOptions();
options.setIndent(2);
options.setPrettyFlow(true);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Yaml yaml = new Yaml(options);
yaml.dump(map, writer);
This line:
is a key
typewith the scalar value!include boolean-types.raml.This proposed line:
is a key
typewith a scalar valueboolean-types.raml, where the scalar node has the explicit tag!include.They are different in semantics. You are apparently giving SnakeYAML data that contains the former and then expect it to output the latter. That can't work, YAML serialization keeps the semantics of the given data. You need to give data that represents the semantics you want to have in the YAML file.
For example, you could define an
Includeclass with a custom representer:Then you can do
and use an
Includeobject where you want to produce the value shown above.