I opened this issue to Jackson regarding customising the Serialisation of a pojo
https://github.com/FasterXML/jackson-dataformats-text/issues/185
They have informed me that it's essentially low level thinkering of the SnakeYaml settings. From looking at that code base within `Jackson` I found the Snake classes that does that.
Atm Jackson produces sample yaml like so
name: "OuterYamlElementName"
label: "OuterYamlElementLabel"
fields:
label: "outerYamlFieldLabel"
value: "outerYamlFieldValue"
isRequired: true
toggle: "+BEYWAYS-Outer-Yaml-Field"
elements:
name: "InnerYamlElementDepthOneName"
label: "InnerYamlElementDepthOneLabel"
fields:
- label: "innerYamlFieldsDepthOneItemOneLabel"
value: "innerYamlFieldsDepthOneItemOneValue"
isRequired: true
toggle: "-BEYWAYS-Inner-Yaml-Fields-Depth-One-Item-One"
- label: "innerYamlFieldsDepthOneItemTwoLabel"
value: "innerYamlFieldsDepthOneItemTwoValue"
isRequired: false
toggle: "-BEYWAYS-Inner-Yaml-Element-Depth-One"
toggle: "+BEYWAYS-Outer-Yaml-Element"
however I'd like the yaml to be generated like so:
name: "OuterYamlElementName"
label: "OuterYamlElementLabel"
fields:
- {label: "outerYamlFieldLabel", value: "outerYamlFieldValue", isRequired: true, toggle: "+BEYWAYS-Outer-Yaml-Field"}
elements:
name: "InnerYamlElementDepthOneName"
label: "InnerYamlElementDepthOneLabel"
fields:
- { label: "innerYamlFieldsDepthOneItemOneLabel", value: "innerYamlFieldsDepthOneItemOneValue", isRequired: true, toggle: "-BEYWAYS-Inner-Yaml-Fields-Depth-One-Item-One" }
- { label: "innerYamlFieldsDepthOneItemTwoLabel", value: "innerYamlFieldsDepthOneItemTwoValue", isRequired: false }
toggle: "-BEYWAYS-Inner-Yaml-Element-Depth-One"
toggle: "+BEYWAYS-Outer-Yaml-Element"
Reason been the Yaml produced is relatively big and I like it to be generated more condensed if possible (I'm only providing a sample atm).
Here is where those settings are configured
I have tried some other settings for example
opt.setDefaultFlowStyle(FlowStyle.Flow);
opt.setMultiLineFlow(true);
unfortunately to no avail. Would anybody know what settings are needed to create the desired structure above? Many thanks in advance.
FlowStyle.AUTO
Cheers,
Andrey
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/a49da664-1530-4844-ae41-ba7bc46615da%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/00ace373-a63e-4675-a497-81ebbaebd9f1%40googlegroups.com.
Serializer creates sequence of Events from a Node.
Emitter translates Events to tokens.
Together they are flexible to output anything.
Good luck,
Andrey
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/e01b42e6-da74-42f7-a791-ec8d7365b4c2%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/44b18ee9-dedf-4b26-b23f-b857fd75f9a9%40googlegroups.com.
https://github.com/FasterXML/jackson-dataformats-text/blob/master/yaml/pom.xml#L32
The above link suggests that 2.1 is already up taken in master which is what I have been using for the last couple of days.
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/15b0c4ef-18b3-4319-8f6f-4879794f87a3%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/00ace373-a63e-4675-a497-81ebbaebd9f1%40googlegroups.com.