How can I dump all possible path of a deserializable struct?
Suppose I have a Config structure that have several nested options, some of them use #[serde(tag = "type")] or more serde attrs.
I'd like to get a table of all possible paths of Config, said:
-
server.http.listern_addris a String -
storage.typecan bes3,azblob, etc. -
storage.bucketis a String.
Is there some way to dump such a schema?
Alternatively, I can enumerate the paths by myself, but in this case, I'd like to write a test to ensure that all the paths are valid (can exist).
https://github.com/zefchain/serde-reflection/tree/main/serde-reflection does this.
Good to know. Although, serde-reflection seems doesn't support #[serde(tag = "type")]:
Attributes that are not compatible with binary formats (e.g. #[serde(flatten)], #[serde(tag = ..)])
I noticed serde-reflection refers to schemars, where I'm waiting for https://github.com/GREsau/schemars/pull/364.
Anyway, this may not something can be done at serde itself. Just I'd like to know if anything else I'm missing.