1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Include empty arrays and maps in the generated Config.md

It's not an ideal solution because there's no indication of what kind of objects
you can add to those maps or arrays, but at least they show up at all (with a
comment containing a link to more information), and that's already an
improvement.
This commit is contained in:
Stefan Haller
2025-03-22 12:24:44 +01:00
parent 0c9154ca9d
commit c3b099398b
2 changed files with 30 additions and 10 deletions

View File

@ -205,16 +205,6 @@ func recurseOverSchema(rootSchema, schema *jsonschema.Schema, parent *Node) {
for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() {
subSchema := getSubSchema(rootSchema, schema, pair.Key)
// Skip empty objects
if subSchema.Type == "object" && subSchema.Properties == nil {
continue
}
// Skip empty arrays
if isZeroValue(subSchema.Default) && subSchema.Type == "array" {
continue
}
node := Node{
Name: pair.Key,
Description: subSchema.Description,
@ -235,6 +225,10 @@ func getZeroValue(val any, t string) any {
return ""
case "boolean":
return false
case "object":
return map[string]any{}
case "array":
return []any{}
default:
return nil
}