Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TOML serialization #83

Open
magneticflux- opened this issue Jul 20, 2020 · 2 comments
Open

Support TOML serialization #83

magneticflux- opened this issue Jul 20, 2020 · 2 comments

Comments

@magneticflux-
Copy link

I have a legacy config in TOML that I need to load using Fiber and I don't want to shadow a whole TOML serde just for a single mod. I saw some discussion about more serializers in #34, but Configurate doesn't support TOML.

I'm ready work on a PR for this change.

@zml2008
Copy link

zml2008 commented Jul 20, 2020

Correctly supporting the toml format and being fully spec-compliant is fairly tricky, and there are good few representation decisions that have to be made to map an arbitrary tree to TOML output. That's why Configurate has not gotten a TOML loader yet, and one of several reasons why I suspect something like fiber would be reluctant to accept a TOML PR.

You also won't get a functional and spec-compliant toml serializer that's much smaller than any of the existing solutions -- so I'd imagine your time would be better spent by just reusing an existing library.

@magneticflux-
Copy link
Author

magneticflux- commented Jul 20, 2020

As of mid-2018 the TOML spec (>= v0.5.0) supports "dotted keys", and it's always supported "tables" (which can be nested). The only thing that can't really be represented is a non-branching root node, e.g. a primitive as the whole config.

I'll play around with an implementation some and wrap it into a PR, and I can always split it into another library if the PR is rejected.

Edit:
Found an old issue about this same thing: mwanji/toml4j#17
I also found that there aren't any good TOML serde libraries. TomlJ looks nice and it modern, but doesn't support serialization: tomlj/tomlj#16

I'll probably just convert my simple TOML to JSON and use Jankson going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants