@@ -34,12 +34,6 @@ type rootProp struct {
3434 topLevel bool
3535}
3636
37- const (
38- AdditionalPropertiesMessage = "Each item has the following attributes:"
39- AdditionalPropertiesAttributeTitle = "<name>"
40- AdditionalPropertiesAttributeDescription = "The definition of the item"
41- )
42-
4337func getNodes (s jsonschema.Schema , refs map [string ]jsonschema.Schema , a annotationFile ) []rootNode {
4438 rootProps := []rootProp {}
4539 for k , v := range s .Properties {
@@ -72,7 +66,11 @@ func getNodes(s jsonschema.Schema, refs map[string]jsonschema.Schema, a annotati
7266 node .ArrayItemAttributes = getAttributes (arrayItemType .Properties , refs )
7367 }
7468
75- nodes = append (nodes , node )
69+ isEmpty := len (node .Attributes ) == 0 && len (node .ObjectKeyAttributes ) == 0 && len (node .ArrayItemAttributes ) == 0
70+ shouldAddNode := ! isEmpty || node .TopLevel
71+ if shouldAddNode {
72+ nodes = append (nodes , node )
73+ }
7674 }
7775
7876 sort .Slice (nodes , func (i , j int ) bool {
@@ -101,7 +99,7 @@ func buildMarkdown(nodes []rootNode, outputFile string) error {
10199
102100 if len (node .ObjectKeyAttributes ) > 0 {
103101 m = buildAttributeTable (m , []attributeNode {
104- {Title : AdditionalPropertiesAttributeTitle , Type : "Map" , Description : AdditionalPropertiesAttributeDescription },
102+ {Title : fmt . Sprintf ( "<%s-entry-name>" , node . Title ), Type : "Map" , Description : fmt . Sprintf ( "Item of the `%s` map" , node . Title ) },
105103 })
106104 m = m .PlainText ("Each item has the following attributes:" )
107105 m = m .LF ()
0 commit comments