mirror of
https://github.com/openai/harmony.git
synced 2025-08-23 01:17:09 -04:00
clippy
This commit is contained in:
parent
d25cd54586
commit
cc89f2a389
1 changed files with 15 additions and 16 deletions
|
@ -411,9 +411,10 @@ impl HarmonyEncoding {
|
||||||
.get("nullable")
|
.get("nullable")
|
||||||
.and_then(|n| n.as_bool())
|
.and_then(|n| n.as_bool())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
&& !type_str.contains("null") {
|
&& !type_str.contains("null")
|
||||||
type_str = format!("{type_str} | null");
|
{
|
||||||
}
|
type_str = format!("{type_str} | null");
|
||||||
|
}
|
||||||
out.push_str(&type_str);
|
out.push_str(&type_str);
|
||||||
// Add trailing comments (description, default)
|
// Add trailing comments (description, default)
|
||||||
let mut trailing_comments = Vec::new();
|
let mut trailing_comments = Vec::new();
|
||||||
|
@ -540,9 +541,7 @@ impl HarmonyEncoding {
|
||||||
let mut rendered_property_desc_above = false;
|
let mut rendered_property_desc_above = false;
|
||||||
if !skip_property_desc {
|
if !skip_property_desc {
|
||||||
if let Some(desc_str) = property_desc {
|
if let Some(desc_str) = property_desc {
|
||||||
out.push_str(&format!(
|
out.push_str(&format!("{indent}// {desc_str}\n"));
|
||||||
"{indent}// {desc_str}\n"
|
|
||||||
));
|
|
||||||
rendered_property_desc_above = true;
|
rendered_property_desc_above = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,9 +588,10 @@ impl HarmonyEncoding {
|
||||||
.get("nullable")
|
.get("nullable")
|
||||||
.and_then(|n| n.as_bool())
|
.and_then(|n| n.as_bool())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
&& !type_str.contains("null") {
|
&& !type_str.contains("null")
|
||||||
type_str = format!("{type_str} | null");
|
{
|
||||||
}
|
type_str = format!("{type_str} | null");
|
||||||
|
}
|
||||||
out.push_str(&type_str);
|
out.push_str(&type_str);
|
||||||
// Add variant-level comments after the type
|
// Add variant-level comments after the type
|
||||||
let mut trailing_comments = Vec::new();
|
let mut trailing_comments = Vec::new();
|
||||||
|
@ -646,17 +646,16 @@ impl HarmonyEncoding {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
// Handle nullable
|
// Handle nullable
|
||||||
let mut type_str = Self::json_schema_to_typescript(
|
let mut type_str =
|
||||||
val,
|
Self::json_schema_to_typescript(val, &format!("{indent} "));
|
||||||
&format!("{indent} "),
|
|
||||||
);
|
|
||||||
if val
|
if val
|
||||||
.get("nullable")
|
.get("nullable")
|
||||||
.and_then(|n| n.as_bool())
|
.and_then(|n| n.as_bool())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
&& !type_str.contains("null") {
|
&& !type_str.contains("null")
|
||||||
type_str = format!("{type_str} | null");
|
{
|
||||||
}
|
type_str = format!("{type_str} | null");
|
||||||
|
}
|
||||||
out.push_str(&type_str);
|
out.push_str(&type_str);
|
||||||
out.push(',');
|
out.push(',');
|
||||||
// Add default as comment if present (and not already handled)
|
// Add default as comment if present (and not already handled)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue