Skip to content

Commit 5dc7714

Browse files
committed
Pluralise collection types
1 parent 6ddafb7 commit 5dc7714

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
@@ -234,12 +234,12 @@ class MyConvertedCode(TerraformStack):
234234
### Optional
235235

236236
- `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.
237-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
237+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
238238

239239
### Read-Only
240240

241241
- `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.
242-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
242+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
243243
- `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.
244244

245245

@@ -344,7 +344,7 @@ class MyConvertedCode(TerraformStack):
344344

345345
### Optional
346346

347-
- `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.
347+
- `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.
348348

349349
### Read-Only
350350

@@ -462,12 +462,12 @@ class MyConvertedCode extends TerraformStack {
462462
### Optional
463463

464464
- `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.
465-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
465+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
466466

467467
### Read-Only
468468

469469
- `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.
470-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
470+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
471471
- `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.
472472

473473

@@ -582,7 +582,7 @@ class MyConvertedCode extends TerraformStack {
582582

583583
### Optional
584584

585-
- `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.
585+
- `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.
586586

587587
### Read-Only
588588

@@ -669,12 +669,12 @@ output "all_server_ips" {
669669
### Optional
670670

671671
- `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.
672-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
672+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
673673

674674
### Read-Only
675675

676676
- `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.
677-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
677+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
678678
- `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.
679679

680680
-- docs/index.md --
@@ -763,7 +763,7 @@ resource "null_resource" "cluster" {
763763

764764
### Optional
765765

766-
- `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.
766+
- `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.
767767

768768
### Read-Only
769769

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
@@ -81,23 +81,23 @@ example resource
8181
- `bool_attribute` (Boolean) example bool attribute
8282
- `float64_attribute` (Number) example float64 attribute
8383
- `int64_attribute` (Number) example int64 attribute
84-
- `list_attribute` (List of String) example list attribute
84+
- `list_attribute` (List of Strings) example list attribute
8585
- `list_nested_block` (Block List) example list nested block (see [below for nested schema](#nestedblock--list_nested_block))
8686
- `list_nested_block_sensitive_nested_attribute` (Block List) (see [below for nested schema](#nestedblock--list_nested_block_sensitive_nested_attribute))
87-
- `map_attribute` (Map of String) example map attribute
87+
- `map_attribute` (Map of Strings) example map attribute
8888
- `number_attribute` (Number) example number attribute
8989
- `object_attribute` (Object) example object attribute (see [below for nested schema](#nestedatt--object_attribute))
9090
- `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))
9191
- `sensitive_bool_attribute` (Boolean, Sensitive) example sensitive bool attribute
9292
- `sensitive_float64_attribute` (Number, Sensitive) example sensitive float64 attribute
9393
- `sensitive_int64_attribute` (Number, Sensitive) example sensitive int64 attribute
94-
- `sensitive_list_attribute` (List of String, Sensitive) example sensitive list attribute
95-
- `sensitive_map_attribute` (Map of String, Sensitive) example sensitive map attribute
94+
- `sensitive_list_attribute` (List of Strings, Sensitive) example sensitive list attribute
95+
- `sensitive_map_attribute` (Map of Strings, Sensitive) example sensitive map attribute
9696
- `sensitive_number_attribute` (Number, Sensitive) example sensitive number attribute
9797
- `sensitive_object_attribute` (Object, Sensitive) example sensitive object attribute (see [below for nested schema](#nestedatt--sensitive_object_attribute))
98-
- `sensitive_set_attribute` (Set of String, Sensitive) example sensitive set attribute
98+
- `sensitive_set_attribute` (Set of Strings, Sensitive) example sensitive set attribute
9999
- `sensitive_string_attribute` (String, Sensitive) example sensitive string attribute
100-
- `set_attribute` (Set of String) example set attribute
100+
- `set_attribute` (Set of Strings) example set attribute
101101
- `set_nested_block` (Block Set) example set nested block (see [below for nested schema](#nestedblock--set_nested_block))
102102
- `single_nested_block` (Block, Optional) example single nested block (see [below for nested schema](#nestedblock--single_nested_block))
103103
- `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))
@@ -230,11 +230,11 @@ scaffolding(stringInput string, boolInput bool, float64Input number, int64Input
230230
1. `boolInput` (Boolean) Value to echo testing
231231
1. `float64Input` (Number) Float64 Value to echo
232232
1. `int64Input` (Number) Int64 Value to echo
233-
1. `listStringInput` (List of String) List of strings to echo
234-
1. `mapStringInput` (Map of String) Map of strings to echo
233+
1. `listStringInput` (List of Strings) List of strings to echo
234+
1. `mapStringInput` (Map of Strings) Map of strings to echo
235235
1. `numberInput` (Number) Number to echo
236236
1. `objectInput` (Object) Object to echo
237-
1. `setStringInput` (Set of String) Set of strings to echo
237+
1. `setStringInput` (Set of Strings) Set of strings to echo
238238
<!-- variadic argument generated by tfplugindocs -->
239239
1. `variadicParam` (Variadic, String) Value to echo
240240
-- 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
@@ -209,12 +209,12 @@ class MyConvertedCode(TerraformStack):
209209
### Optional
210210

211211
- `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.
212-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
212+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
213213

214214
### Read-Only
215215

216216
- `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.
217-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
217+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
218218
- `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.
219219

220220

@@ -319,7 +319,7 @@ class MyConvertedCode(TerraformStack):
319319

320320
### Optional
321321

322-
- `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.
322+
- `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.
323323

324324
### Read-Only
325325

@@ -437,12 +437,12 @@ class MyConvertedCode extends TerraformStack {
437437
### Optional
438438

439439
- `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.
440-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
440+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
441441

442442
### Read-Only
443443

444444
- `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.
445-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
445+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
446446
- `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.
447447

448448

@@ -557,7 +557,7 @@ class MyConvertedCode extends TerraformStack {
557557

558558
### Optional
559559

560-
- `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.
560+
- `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.
561561

562562
### Read-Only
563563

@@ -644,12 +644,12 @@ output "all_server_ips" {
644644
### Optional
645645

646646
- `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.
647-
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
647+
- `inputs` (Map of Strings) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
648648

649649
### Read-Only
650650

651651
- `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.
652-
- `outputs` (Map of String) After the data source is "read", a copy of the `inputs` map.
652+
- `outputs` (Map of Strings) After the data source is "read", a copy of the `inputs` map.
653653
- `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.
654654

655655
-- docs/index.md --
@@ -738,7 +738,7 @@ resource "null_resource" "cluster" {
738738

739739
### Optional
740740

741-
- `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.
741+
- `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.
742742

743743
### Read-Only
744744

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)