Skip to content

Commit a90bb25

Browse files
committed
Pluralise collection types
1 parent 5283494 commit a90bb25

File tree

8 files changed

+51
-45
lines changed

8 files changed

+51
-45
lines changed

cmd/tfplugindocs/testdata/scripts/provider-build/generate/null_provider_success.txtar

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ class MyConvertedCode(TerraformStack):
232232
### Optional
233233

234234
- `has_computed_default` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
235-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
235+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
236236

237237
### Read-Only
238238

239239
- `id` (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
240-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
240+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
241241
- `random` (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
242242

243243

@@ -342,7 +342,7 @@ class MyConvertedCode(TerraformStack):
342342

343343
### Optional
344344

345-
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
345+
- `triggers` (Map of Strings) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
346346

347347
### Read-Only
348348

@@ -460,12 +460,12 @@ class MyConvertedCode extends TerraformStack {
460460
### Optional
461461

462462
- `hasComputedDefault` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
463-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
463+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
464464

465465
### Read-Only
466466

467467
- `id` (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
468-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
468+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
469469
- `random` (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
470470

471471

@@ -580,7 +580,7 @@ class MyConvertedCode extends TerraformStack {
580580

581581
### Optional
582582

583-
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
583+
- `triggers` (Map of Strings) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
584584

585585
### Read-Only
586586

@@ -667,12 +667,12 @@ output "all_server_ips" {
667667
### Optional
668668

669669
- `has_computed_default` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
670-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
670+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
671671

672672
### Read-Only
673673

674674
- `id` (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
675-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
675+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
676676
- `random` (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
677677

678678
-- docs/index.md --
@@ -761,7 +761,7 @@ resource "null_resource" "cluster" {
761761

762762
### Optional
763763

764-
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
764+
- `triggers` (Map of Strings) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
765765

766766
### Read-Only
767767

cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,23 @@ example resource
8080
- `bool_attribute` (Boolean) example bool attribute
8181
- `float64_attribute` (Number) example float64 attribute
8282
- `int64_attribute` (Number) example int64 attribute
83-
- `list_attribute` (List of String) example list attribute
83+
- `list_attribute` (List of Strings) example list attribute
8484
- `list_nested_block` (Block List) example list nested block (see [below for nested schema](#nestedblock--list_nested_block))
8585
- `list_nested_block_sensitive_nested_attribute` (Block List) (see [below for nested schema](#nestedblock--list_nested_block_sensitive_nested_attribute))
86-
- `map_attribute` (Map of String) example map attribute
86+
- `map_attribute` (Map of Strings) example map attribute
8787
- `number_attribute` (Number) example number attribute
8888
- `object_attribute` (Object) example object attribute (see [below for nested schema](#nestedatt--object_attribute))
8989
- `object_attribute_with_nested_object_attribute` (Object) example object attribute with nested object attribute (see [below for nested schema](#nestedatt--object_attribute_with_nested_object_attribute))
9090
- `sensitive_bool_attribute` (Boolean, Sensitive) example sensitive bool attribute
9191
- `sensitive_float64_attribute` (Number, Sensitive) example sensitive float64 attribute
9292
- `sensitive_int64_attribute` (Number, Sensitive) example sensitive int64 attribute
93-
- `sensitive_list_attribute` (List of String, Sensitive) example sensitive list attribute
94-
- `sensitive_map_attribute` (Map of String, Sensitive) example sensitive map attribute
93+
- `sensitive_list_attribute` (List of Strings, Sensitive) example sensitive list attribute
94+
- `sensitive_map_attribute` (Map of Strings, Sensitive) example sensitive map attribute
9595
- `sensitive_number_attribute` (Number, Sensitive) example sensitive number attribute
9696
- `sensitive_object_attribute` (Object, Sensitive) example sensitive object attribute (see [below for nested schema](#nestedatt--sensitive_object_attribute))
97-
- `sensitive_set_attribute` (Set of String, Sensitive) example sensitive set attribute
97+
- `sensitive_set_attribute` (Set of Strings, Sensitive) example sensitive set attribute
9898
- `sensitive_string_attribute` (String, Sensitive) example sensitive string attribute
99-
- `set_attribute` (Set of String) example set attribute
99+
- `set_attribute` (Set of Strings) example set attribute
100100
- `set_nested_block` (Block Set) example set nested block (see [below for nested schema](#nestedblock--set_nested_block))
101101
- `single_nested_block` (Block, Optional) example single nested block (see [below for nested schema](#nestedblock--single_nested_block))
102102
- `single_nested_block_sensitive_nested_attribute` (Block, Optional) example sensitive single nested block (see [below for nested schema](#nestedblock--single_nested_block_sensitive_nested_attribute))
@@ -229,11 +229,11 @@ scaffolding(stringInput string, boolInput bool, float64Input number, int64Input
229229
1. `boolInput` (Boolean) Value to echo testing
230230
1. `float64Input` (Number) Float64 Value to echo
231231
1. `int64Input` (Number) Int64 Value to echo
232-
1. `listStringInput` (List of String) List of strings to echo
233-
1. `mapStringInput` (Map of String) Map of strings to echo
232+
1. `listStringInput` (List of Strings) List of strings to echo
233+
1. `mapStringInput` (Map of Strings) Map of strings to echo
234234
1. `numberInput` (Number) Number to echo
235235
1. `objectInput` (Object) Object to echo
236-
1. `setStringInput` (Set of String) Set of strings to echo
236+
1. `setStringInput` (Set of Strings) Set of strings to echo
237237
<!-- variadic argument generated by tfplugindocs -->
238238
1. `variadicParam` (Variadic, String) Value to echo
239239
-- schema.json --

cmd/tfplugindocs/testdata/scripts/schema-json/generate/null_provider_success.txtar

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ class MyConvertedCode(TerraformStack):
207207
### Optional
208208

209209
- `has_computed_default` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
210-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
210+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
211211

212212
### Read-Only
213213

214214
- `id` (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
215-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
215+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
216216
- `random` (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
217217

218218

@@ -317,7 +317,7 @@ class MyConvertedCode(TerraformStack):
317317

318318
### Optional
319319

320-
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
320+
- `triggers` (Map of Strings) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
321321

322322
### Read-Only
323323

@@ -435,12 +435,12 @@ class MyConvertedCode extends TerraformStack {
435435
### Optional
436436

437437
- `hasComputedDefault` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
438-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
438+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
439439

440440
### Read-Only
441441

442442
- `id` (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
443-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
443+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
444444
- `random` (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
445445

446446

@@ -555,7 +555,7 @@ class MyConvertedCode extends TerraformStack {
555555

556556
### Optional
557557

558-
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
558+
- `triggers` (Map of Strings) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
559559

560560
### Read-Only
561561

@@ -642,12 +642,12 @@ output "all_server_ips" {
642642
### Optional
643643

644644
- `has_computed_default` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
645-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
645+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
646646

647647
### Read-Only
648648

649649
- `id` (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
650-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
650+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
651651
- `random` (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
652652

653653
-- docs/index.md --
@@ -736,7 +736,7 @@ resource "null_resource" "cluster" {
736736

737737
### Optional
738738

739-
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
739+
- `triggers` (Map of Strings) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
740740

741741
### Read-Only
742742

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
1. `input` (String) Value to echo.
22
1. `int64Input` (Number) Int64 Value to echo.
3-
1. `listStringInput` (List of String) List of strings to echo.
4-
1. `mapStringInput` (Map of String) Map of strings to echo.
3+
1. `listStringInput` (List of Strings) List of strings to echo.
4+
1. `mapStringInput` (Map of Strings) Map of strings to echo.
55
1. `objectInput` (Object) Object to echo.

internal/schemamd/testdata/aws_acm_certificate.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
- `domain_name` (String)
99
- `options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--options))
1010
- `private_key` (String, Sensitive)
11-
- `subject_alternative_names` (Set of String)
12-
- `tags` (Map of String)
13-
- `tags_all` (Map of String)
11+
- `subject_alternative_names` (Set of Strings)
12+
- `tags` (Map of Strings)
13+
- `tags_all` (Map of Strings)
1414
- `validation_method` (String)
1515

1616
### Read-Only
1717

1818
- `arn` (String)
19-
- `domain_validation_options` (Set of Object) (see [below for nested schema](#nestedatt--domain_validation_options))
19+
- `domain_validation_options` (Set of Objects) (see [below for nested schema](#nestedatt--domain_validation_options))
2020
- `id` (String) The ID of this resource.
2121
- `status` (String)
22-
- `validation_emails` (List of String)
22+
- `validation_emails` (List of Strings)
2323

2424
<a id="nestedblock--options"></a>
2525
### Nested Schema for `options`

internal/schemamd/testdata/framework_types.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
- `bool_attribute` (Boolean) example bool attribute
1414
- `float64_attribute` (Number) example float64 attribute
1515
- `int64_attribute` (Number) example int64 attribute
16-
- `list_attribute` (List of String) example list attribute
16+
- `list_attribute` (List of Strings) example list attribute
1717
- `list_nested_block` (Block List) example list nested block (see [below for nested schema](#nestedblock--list_nested_block))
1818
- `list_nested_block_sensitive_nested_attribute` (Block List) (see [below for nested schema](#nestedblock--list_nested_block_sensitive_nested_attribute))
19-
- `map_attribute` (Map of String) example map attribute
19+
- `map_attribute` (Map of Strings) example map attribute
2020
- `number_attribute` (Number) example number attribute
2121
- `object_attribute` (Object) example object attribute (see [below for nested schema](#nestedatt--object_attribute))
2222
- `object_attribute_with_nested_object_attribute` (Object) example object attribute with nested object attribute (see [below for nested schema](#nestedatt--object_attribute_with_nested_object_attribute))
2323
- `sensitive_bool_attribute` (Boolean, Sensitive) example sensitive bool attribute
2424
- `sensitive_float64_attribute` (Number, Sensitive) example sensitive float64 attribute
2525
- `sensitive_int64_attribute` (Number, Sensitive) example sensitive int64 attribute
26-
- `sensitive_list_attribute` (List of String, Sensitive) example sensitive list attribute
27-
- `sensitive_map_attribute` (Map of String, Sensitive) example sensitive map attribute
26+
- `sensitive_list_attribute` (List of Strings, Sensitive) example sensitive list attribute
27+
- `sensitive_map_attribute` (Map of Strings, Sensitive) example sensitive map attribute
2828
- `sensitive_number_attribute` (Number, Sensitive) example sensitive number attribute
2929
- `sensitive_object_attribute` (Object, Sensitive) example sensitive object attribute (see [below for nested schema](#nestedatt--sensitive_object_attribute))
30-
- `sensitive_set_attribute` (Set of String, Sensitive) example sensitive set attribute
30+
- `sensitive_set_attribute` (Set of Strings, Sensitive) example sensitive set attribute
3131
- `sensitive_string_attribute` (String, Sensitive) example sensitive string attribute
32-
- `set_attribute` (Set of String) example set attribute
32+
- `set_attribute` (Set of Strings) example set attribute
3333
- `set_nested_block` (Block Set) example set nested block (see [below for nested schema](#nestedblock--set_nested_block))
3434
- `single_nested_block` (Block, Optional) example single nested block (see [below for nested schema](#nestedblock--single_nested_block))
3535
- `single_nested_block_sensitive_nested_attribute` (Block, Optional) example sensitive single nested block (see [below for nested schema](#nestedblock--single_nested_block_sensitive_nested_attribute))

internal/schemamd/write_type.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ func WriteType(w io.Writer, ty cty.Type) error {
5252
if err != nil {
5353
return fmt.Errorf("unable to write element type for %q: %w", ty.FriendlyName(), err)
5454
}
55+
if !ty.ElementType().IsCollectionType() {
56+
_, err = io.WriteString(w, "s")
57+
if err != nil {
58+
return err
59+
}
60+
}
5561
return nil
5662
case ty.IsTupleType():
5763
// TODO: write additional type info?

internal/schemamd/write_type_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ func TestWriteType(t *testing.T) {
3030
// {"Number", cty.NilType},
3131
// {"Number", cty.Capsule("foo", reflect.TypeOf(1))},
3232

33-
{"List of Boolean", cty.List(cty.Bool)},
34-
{"List of Dynamic", cty.List(cty.DynamicPseudoType)},
33+
{"List of Booleans", cty.List(cty.Bool)},
34+
{"List of Dynamics", cty.List(cty.DynamicPseudoType)},
3535

36-
{"Map of Boolean", cty.Map(cty.Bool)},
36+
{"Map of Booleans", cty.Map(cty.Bool)},
3737

3838
{"Object", cty.EmptyObject},
3939
{"Object", cty.Object(map[string]cty.Type{
4040
"bool": cty.Bool,
4141
})},
4242

43-
{"Set of Boolean", cty.Set(cty.Bool)},
43+
{"Set of Booleans", cty.Set(cty.Bool)},
4444

4545
{"Tuple", cty.EmptyTuple},
4646
{"Tuple", cty.Tuple([]cty.Type{cty.Bool})},
4747

48-
{"List of Map of Set of Object", cty.List(cty.Map(cty.Set(cty.Object(map[string]cty.Type{
48+
{"List of Map of Set of Objects", cty.List(cty.Map(cty.Set(cty.Object(map[string]cty.Type{
4949
"bool": cty.Bool,
5050
}))))},
5151
} {

0 commit comments

Comments
 (0)