-
Notifications
You must be signed in to change notification settings - Fork 253
Description
I would like a way to generate some kind of document that can serve as a canonical reference for the config values in my app, their sources, and their defaults. This should ideally incorporate both the doc-comments from the config struct(s) deserialized from my config-builder as well as the information about defaults and priority that the builder internalizes as part of the configuration setup.
So this would need to be some kind of function or macro that takes both a (fully configured) config-builder struct and a config type, and then generates a data structure mapping the serde::Deserialize fields to any corresponding defaults and sources from the config builder, in a form that can then be used to generate e.g. a markdown table (the actual formatting doesn't need to be part of this crate as long as the data is in some kind of form that the user can work with).
Is something like this even possible? I imagine that getting the Deserialize field names at runtime might be hacky; perhaps this would need to be implemented as an "alternate deserializer" that records what fields serde checks for as it goes.
Originally posted by @BatmanAoD in #661
(opening as an issue per the request in #321)