mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 04:48:33 +07:00
doc: Allow top-level comments for variables when description missing
Documenting variables with description and outputs with top-level comments breaks workflow, depending on what one is used to. This update allows variables to be documented with top-level comments in the same way that outputs are, if no description is present.
This commit is contained in:
@@ -77,7 +77,13 @@ func inputs(list *ast.ObjectList) []Input {
|
||||
if is(item, "variable") {
|
||||
name, _ := strconv.Unquote(item.Keys[1].Token.Text)
|
||||
items := item.Val.(*ast.ObjectType).List.Items
|
||||
desc := description(items)
|
||||
var desc string
|
||||
switch {
|
||||
case description(items) != "":
|
||||
desc = description(items)
|
||||
case item.LeadComment != nil:
|
||||
desc = comment(item.LeadComment.List)
|
||||
}
|
||||
def := get(items, "default")
|
||||
ret = append(ret, Input{
|
||||
Name: name,
|
||||
|
||||
Reference in New Issue
Block a user