@@ -57,11 +57,12 @@ var (
5757)
5858
5959type nestedType struct {
60- anchorID string
61- path []string
62- block * tfjson.SchemaBlock
63- object * cty.Type
64- attrs * tfjson.SchemaNestedAttributeType
60+ anchorID string
61+ pathTitle string
62+ path []string
63+ block * tfjson.SchemaBlock
64+ object * cty.Type
65+ attrs * tfjson.SchemaNestedAttributeType
6566
6667 group groupFilter
6768}
@@ -87,6 +88,7 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
8788 }
8889
8990 anchorID := "nestedatt--" + strings .Join (path , "--" )
91+ pathTitle := strings .Join (path , "." )
9092 nestedTypes := []nestedType {}
9193 switch {
9294 case att .AttributeNestedType != nil :
@@ -96,9 +98,10 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
9698 }
9799
98100 nestedTypes = append (nestedTypes , nestedType {
99- anchorID : anchorID ,
100- path : path ,
101- attrs : att .AttributeNestedType ,
101+ anchorID : anchorID ,
102+ pathTitle : pathTitle ,
103+ path : path ,
104+ attrs : att .AttributeNestedType ,
102105
103106 group : group ,
104107 })
@@ -109,9 +112,10 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
109112 }
110113
111114 nestedTypes = append (nestedTypes , nestedType {
112- anchorID : anchorID ,
113- path : path ,
114- object : & att .AttributeType ,
115+ anchorID : anchorID ,
116+ pathTitle : pathTitle ,
117+ path : path ,
118+ object : & att .AttributeType ,
115119
116120 group : group ,
117121 })
@@ -123,9 +127,10 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
123127
124128 nt := att .AttributeType .ElementType ()
125129 nestedTypes = append (nestedTypes , nestedType {
126- anchorID : anchorID ,
127- path : path ,
128- object : & nt ,
130+ anchorID : anchorID ,
131+ pathTitle : pathTitle ,
132+ path : path ,
133+ object : & nt ,
129134
130135 group : group ,
131136 })
@@ -153,10 +158,12 @@ func writeBlockType(w io.Writer, path []string, block *tfjson.SchemaBlockType) (
153158 }
154159
155160 anchorID := "nestedblock--" + strings .Join (path , "--" )
161+ pathTitle := strings .Join (path , "." )
156162 nt := nestedType {
157- anchorID : anchorID ,
158- path : path ,
159- block : block .Block ,
163+ anchorID : anchorID ,
164+ pathTitle : pathTitle ,
165+ path : path ,
166+ block : block .Block ,
160167 }
161168
162169 _ , err = io .WriteString (w , " (see [below for nested schema](#" + anchorID + "))" )
@@ -344,7 +351,7 @@ func writeNestedTypes(w io.Writer, nestedTypes []nestedType) error {
344351 return err
345352 }
346353
347- _ , err = io .WriteString (w , "### Nested Schema for `" + strings . Join ( nt .path , "." ) + "`\n \n " )
354+ _ , err = io .WriteString (w , "### Nested Schema for `" + nt .pathTitle + "`\n \n " )
348355 if err != nil {
349356 return err
350357 }
0 commit comments