Docs: std.md now displays correct number of members of an array (#825)
* First draft up * removed print statements * running cargo fmt --------- Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8ad1476c13
commit
03bc2eaf22
1182
docs/kcl/std.md
1182
docs/kcl/std.md
File diff suppressed because it is too large
Load Diff
@ -316,7 +316,17 @@ pub fn get_type_string_from_schema(schema: &schemars::schema::Schema) -> Result<
|
||||
if let Some(array_val) = &o.array {
|
||||
if let Some(schemars::schema::SingleOrVec::Single(items)) = &array_val.items {
|
||||
// Let's print out the object's properties.
|
||||
return Ok((format!("[{}]", get_type_string_from_schema(items)?.0), false));
|
||||
match array_val.max_items {
|
||||
Some(val) => {
|
||||
return Ok((
|
||||
format!("[{}]", (0..val).map(|_| "number").collect::<Vec<_>>().join(", ")),
|
||||
false,
|
||||
));
|
||||
}
|
||||
None => {
|
||||
return Ok((format!("[{}]", get_type_string_from_schema(items)?.0), false));
|
||||
}
|
||||
};
|
||||
} else if let Some(items) = &array_val.contains {
|
||||
return Ok((format!("[{}]", get_type_string_from_schema(items)?.0), false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user