use crate::prelude::*;
#[derive(Document)]
struct Ty {
#[doku(example = "f1-value")]
f1: String,
#[doku(example = "f2-value")]
f2: Option<String>,
#[doku(example = "f3-value")]
f3: Option<NestedStringA>,
#[doku(example = "f4-value")]
f4: Option<NestedStringB>,
#[doku(example = "f5-value")]
f5: Option<NestedStringC>,
#[doku(example = "f6-value")]
f6: Option<Option<Option<String>>>,
f7: NestedStringD,
}
#[derive(Document)]
struct NestedStringA(String);
#[derive(Document)]
struct NestedStringB(NestedStringA);
#[derive(Document)]
#[doku(transparent)]
struct NestedStringC {
value: NestedStringB,
}
struct NestedStringD;
impl doku::Document for NestedStringD {
fn ty() -> doku::Type {
doku::Type {
example: Some(doku::Example::Simple("f7-value")),
..String::ty()
}
}
}
printer_test! {
"output.json" => to_json(Ty),
"output.without-comma.json" => to_json_without_comma(Ty),
"output.without-key-quotes.json" => to_json_without_key_quotes(Ty),
"output.toml" => to_toml(Ty),
}