circe / circe-yaml

YAML parser for circe using SnakeYAML
Apache License 2.0
141 stars 51 forks source link

Added indent with indicators to yaml-v12 #406

Closed aheiska closed 2 months ago

aheiska commented 10 months ago

Enables to indent yaml like:

root:
  - item1
  - item2

This applies only to circe-yaml-v12. I could not come up with a way to do it for circe-yaml in a binary compatible way (I would assume this is binary compatible).

Test copied from https://github.com/circe/circe-yaml/pull/398 and implemented PrinterBuilder builder as suggested there.

I also added deprecations. Values are just a guess and maintainers can of course change then as they see fit.

aheiska commented 10 months ago

Also made relevant changes to circe-yaml. That required implementation of PrinterBuilder & PrinterImpl to circe-yaml. They are mostly independent of old Printer (notable exception being Printer.Yamlversion). I would assume this allows extending the printer configuration api in a backwards compatible way. As always, maintainer are welcome to add/edit depreciations in a way they see fit.

Also the io.circe.yaml.PrinterBuilder has SnakeStringStyle extension in it (could not come up with a better place). We cannot use one from common, because snake-yaml versions use different ScalarStyle. Other circe-yaml spesific setting enums are pattern matched at PrinterBuilder.build but .toScalarStyle is used also from PrinterImpl

aheiska commented 2 months ago

Thank you for your review. I made the changes you requested.