Replies: 1 comment
-
schemars exists to take mostly-serde and generate jsonschema (for my uses, I need the 1.0 prerelease for bug fixes). You could use that and generate docs off jsonschema, which would miss env fields, or write something similar. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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 fieldsserde
checks for as it goes.Beta Was this translation helpful? Give feedback.
All reactions