@@ -57,11 +57,12 @@ var (
57
57
)
58
58
59
59
type 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
65
66
66
67
group groupFilter
67
68
}
@@ -87,6 +88,7 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
87
88
}
88
89
89
90
anchorID := "nestedatt--" + strings .Join (path , "--" )
91
+ pathTitle := strings .Join (path , "." )
90
92
nestedTypes := []nestedType {}
91
93
switch {
92
94
case att .AttributeNestedType != nil :
@@ -96,9 +98,10 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
96
98
}
97
99
98
100
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 ,
102
105
103
106
group : group ,
104
107
})
@@ -109,9 +112,10 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
109
112
}
110
113
111
114
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 ,
115
119
116
120
group : group ,
117
121
})
@@ -123,9 +127,10 @@ func writeAttribute(w io.Writer, path []string, att *tfjson.SchemaAttribute, gro
123
127
124
128
nt := att .AttributeType .ElementType ()
125
129
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 ,
129
134
130
135
group : group ,
131
136
})
@@ -153,10 +158,12 @@ func writeBlockType(w io.Writer, path []string, block *tfjson.SchemaBlockType) (
153
158
}
154
159
155
160
anchorID := "nestedblock--" + strings .Join (path , "--" )
161
+ pathTitle := strings .Join (path , "." )
156
162
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 ,
160
167
}
161
168
162
169
_ , err = io .WriteString (w , " (see [below for nested schema](#" + anchorID + "))" )
@@ -344,7 +351,7 @@ func writeNestedTypes(w io.Writer, nestedTypes []nestedType) error {
344
351
return err
345
352
}
346
353
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 " )
348
355
if err != nil {
349
356
return err
350
357
}
0 commit comments