1
0
Fork 0

better document structs

This commit is contained in:
Cyborus 2024-02-09 17:02:42 -05:00
parent 11c0798775
commit 4d63cd09c1
No known key found for this signature in database
2 changed files with 1002 additions and 0 deletions

View file

@ -65,6 +65,15 @@ pub fn create_struct_for_definition(
if field_ty == "Option<time::OffsetDateTime>" {
fields.push_str("#[serde(with = \"time::serde::rfc3339::option\")]\n");
}
if let MaybeRef::Value { value } = &prop_schema {
if let Some(desc) = &value.description {
for line in desc.lines() {
fields.push_str("/// ");
fields.push_str(line);
fields.push_str("\n/// \n");
}
}
}
if &field_name != prop_name {
fields.push_str("#[serde(rename = \"");
fields.push_str(prop_name);
@ -159,6 +168,13 @@ fn create_query_struct(op: &Operation) -> eyre::Result<String> {
if let ParameterIn::Query { param: query_param } = &param._in {
let ty = crate::methods::param_type(query_param, true)?;
let field_name = crate::sanitize_ident(&param.name);
if let Some(desc) = &param.description {
for line in desc.lines() {
fields.push_str("/// ");
fields.push_str(line);
fields.push_str("\n/// \n");
}
}
fields.push_str("pub ");
fields.push_str(&field_name);
fields.push_str(": ");

File diff suppressed because it is too large Load diff