NowanIlfideme / pydantic-yaml

YAML support for Pydantic models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customize YAML dumping order

NowanIlfideme opened this issue · comments

It would be nice to dump YAML keys in field order, rather than alphabetic order. Perhaps this could be done via the Config class.

commented

I stumbled upon this issue today after switching from pyyaml to ruamel.yaml. Would be a much appreciated feature!

I actually implemented this a week ago, but didn't have time to fully validate it locally to release it. I'm unsure whether it's best to change the default order to dump it by keys. Probably yes, will just need to set a new minor version for a breaking change.

Yep, now available in 0.7.1 (default off) or 0.8.0 (default on) 😉