From a1b156e178f678bf37d36248d6bd08ff968e4d49 Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Wed, 13 Mar 2024 16:39:52 -0400 Subject: [PATCH] Refactor `schemamd` and `functionmd` packages to `internal/` --- README.md | 10 ++-------- {functionmd => internal/functionmd}/render.go | 2 +- {functionmd => internal/functionmd}/render_test.go | 2 +- .../functionmd}/testdata/example_arguments.md | 0 .../functionmd}/testdata/example_signature.md | 0 .../functionmd}/testdata/example_vararg.md | 0 .../testdata/function_signature.schema.json | 0 internal/provider/template.go | 4 ++-- {schemamd => internal/schemamd}/behaviors.go | 0 {schemamd => internal/schemamd}/behaviors_test.go | 0 {schemamd => internal/schemamd}/render.go | 0 {schemamd => internal/schemamd}/render_test.go | 3 ++- .../schemamd}/testdata/aws_acm_certificate.md | 0 .../schemamd}/testdata/aws_acm_certificate.schema.json | 0 .../schemamd}/testdata/aws_route_table_association.md | 0 .../testdata/aws_route_table_association.schema.json | 0 .../schemamd}/testdata/awscc_acmpca_certificate.md | 0 .../testdata/awscc_acmpca_certificate.schema.json | 0 .../schemamd}/testdata/awscc_logs_log_group.md | 0 .../testdata/awscc_logs_log_group.schema.json | 0 .../schemamd}/write_attribute_description.go | 0 .../schemamd}/write_attribute_description_test.go | 2 +- .../schemamd}/write_block_type_description.go | 0 .../schemamd}/write_block_type_description_test.go | 3 ++- .../write_nested_attribute_type_description.go | 0 .../write_nested_attribute_type_description_test.go | 3 ++- {schemamd => internal/schemamd}/write_type.go | 0 {schemamd => internal/schemamd}/write_type_test.go | 2 +- 28 files changed, 14 insertions(+), 17 deletions(-) rename {functionmd => internal/functionmd}/render.go (97%) rename {functionmd => internal/functionmd}/render_test.go (97%) rename {functionmd => internal/functionmd}/testdata/example_arguments.md (100%) rename {functionmd => internal/functionmd}/testdata/example_signature.md (100%) rename {functionmd => internal/functionmd}/testdata/example_vararg.md (100%) rename {functionmd => internal/functionmd}/testdata/function_signature.schema.json (100%) rename {schemamd => internal/schemamd}/behaviors.go (100%) rename {schemamd => internal/schemamd}/behaviors_test.go (100%) rename {schemamd => internal/schemamd}/render.go (100%) rename {schemamd => internal/schemamd}/render_test.go (96%) rename {schemamd => internal/schemamd}/testdata/aws_acm_certificate.md (100%) rename {schemamd => internal/schemamd}/testdata/aws_acm_certificate.schema.json (100%) rename {schemamd => internal/schemamd}/testdata/aws_route_table_association.md (100%) rename {schemamd => internal/schemamd}/testdata/aws_route_table_association.schema.json (100%) rename {schemamd => internal/schemamd}/testdata/awscc_acmpca_certificate.md (100%) rename {schemamd => internal/schemamd}/testdata/awscc_acmpca_certificate.schema.json (100%) rename {schemamd => internal/schemamd}/testdata/awscc_logs_log_group.md (100%) rename {schemamd => internal/schemamd}/testdata/awscc_logs_log_group.schema.json (100%) rename {schemamd => internal/schemamd}/write_attribute_description.go (100%) rename {schemamd => internal/schemamd}/write_attribute_description_test.go (98%) rename {schemamd => internal/schemamd}/write_block_type_description.go (100%) rename {schemamd => internal/schemamd}/write_block_type_description_test.go (98%) rename {schemamd => internal/schemamd}/write_nested_attribute_type_description.go (100%) rename {schemamd => internal/schemamd}/write_nested_attribute_type_description_test.go (97%) rename {schemamd => internal/schemamd}/write_type.go (100%) rename {schemamd => internal/schemamd}/write_type_test.go (95%) diff --git a/README.md b/README.md index df5c19c6..8d9c7d38 100644 --- a/README.md +++ b/README.md @@ -158,8 +158,8 @@ The `validate` subcommand can be used to validate the provider website documenta |---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `InvalidDirectoriesCheck` | Checks for valid subdirectory structure and throws an error if an invalid Terraform Provider documentation subdirectory is found. | | `MixedDirectoriesCheck` | Throws an error if both legacy documentation (`/website/docs`) and registry documentation (`/docs`) are found. | -| `NumberOfFilesCheck` | Throws an error if the number of files in a directory is larger than the registry limit. | -| `FileSizeCheck` | Throws an error if the documentation file is above the registry storage limit. | +| `NumberOfFilesCheck` | Throws an error if the number of files in a directory is larger than the public registry limit. | +| `FileSizeCheck` | Throws an error if the documentation file is above the public registry storage limit. | | `FileExtensionCheck` | Throws an error if the extension of the given file is not a valid registry documentation extension. | | `FrontMatterCheck` | Checks the YAML frontmatter of documentation for missing required fields or invalid fields. | | `FileMismatchCheck` | Throws an error if the names/number of resources/datasources/functions in the provider schema does not match the names/number of files in the corresponding documentation directory | @@ -327,12 +327,6 @@ Your help and patience is truly appreciated. ## Contributing -## Go Compatibility - -This project follows the [support policy](https://golang.org/doc/devel/release.html#policy) of Go as its support policy. The two latest major releases of Go are supported by the project. - -Currently, that means Go **1.21** or later must be used when including this project as a dependency. - ### License Headers All source code files in this repository (excluding autogenerated files like `go.mod`, prose, and files excluded in [.copywrite.hcl](.copywrite.hcl)) must have a license header at the top. diff --git a/functionmd/render.go b/internal/functionmd/render.go similarity index 97% rename from functionmd/render.go rename to internal/functionmd/render.go index fdea3a82..7b4951b7 100644 --- a/functionmd/render.go +++ b/internal/functionmd/render.go @@ -10,7 +10,7 @@ import ( tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-docs/schemamd" + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" ) // RenderArguments returns a Markdown formatted string of the function arguments. diff --git a/functionmd/render_test.go b/internal/functionmd/render_test.go similarity index 97% rename from functionmd/render_test.go rename to internal/functionmd/render_test.go index c76c37a7..dbc8e5cf 100644 --- a/functionmd/render_test.go +++ b/internal/functionmd/render_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/go-cmp/cmp" tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-docs/functionmd" + "github.com/hashicorp/terraform-plugin-docs/internal/functionmd" ) func TestRenderArguments(t *testing.T) { diff --git a/functionmd/testdata/example_arguments.md b/internal/functionmd/testdata/example_arguments.md similarity index 100% rename from functionmd/testdata/example_arguments.md rename to internal/functionmd/testdata/example_arguments.md diff --git a/functionmd/testdata/example_signature.md b/internal/functionmd/testdata/example_signature.md similarity index 100% rename from functionmd/testdata/example_signature.md rename to internal/functionmd/testdata/example_signature.md diff --git a/functionmd/testdata/example_vararg.md b/internal/functionmd/testdata/example_vararg.md similarity index 100% rename from functionmd/testdata/example_vararg.md rename to internal/functionmd/testdata/example_vararg.md diff --git a/functionmd/testdata/function_signature.schema.json b/internal/functionmd/testdata/function_signature.schema.json similarity index 100% rename from functionmd/testdata/function_signature.schema.json rename to internal/functionmd/testdata/function_signature.schema.json diff --git a/internal/provider/template.go b/internal/provider/template.go index 10f2e655..fad187c4 100644 --- a/internal/provider/template.go +++ b/internal/provider/template.go @@ -16,10 +16,10 @@ import ( tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-docs/functionmd" + "github.com/hashicorp/terraform-plugin-docs/internal/functionmd" "github.com/hashicorp/terraform-plugin-docs/internal/mdplain" + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" "github.com/hashicorp/terraform-plugin-docs/internal/tmplfuncs" - "github.com/hashicorp/terraform-plugin-docs/schemamd" ) const ( diff --git a/schemamd/behaviors.go b/internal/schemamd/behaviors.go similarity index 100% rename from schemamd/behaviors.go rename to internal/schemamd/behaviors.go diff --git a/schemamd/behaviors_test.go b/internal/schemamd/behaviors_test.go similarity index 100% rename from schemamd/behaviors_test.go rename to internal/schemamd/behaviors_test.go diff --git a/schemamd/render.go b/internal/schemamd/render.go similarity index 100% rename from schemamd/render.go rename to internal/schemamd/render.go diff --git a/schemamd/render_test.go b/internal/schemamd/render_test.go similarity index 96% rename from schemamd/render_test.go rename to internal/schemamd/render_test.go index 447826db..6d46ecd4 100644 --- a/schemamd/render_test.go +++ b/internal/schemamd/render_test.go @@ -11,7 +11,8 @@ import ( "github.com/google/go-cmp/cmp" tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-docs/schemamd" + + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" ) func TestRender(t *testing.T) { diff --git a/schemamd/testdata/aws_acm_certificate.md b/internal/schemamd/testdata/aws_acm_certificate.md similarity index 100% rename from schemamd/testdata/aws_acm_certificate.md rename to internal/schemamd/testdata/aws_acm_certificate.md diff --git a/schemamd/testdata/aws_acm_certificate.schema.json b/internal/schemamd/testdata/aws_acm_certificate.schema.json similarity index 100% rename from schemamd/testdata/aws_acm_certificate.schema.json rename to internal/schemamd/testdata/aws_acm_certificate.schema.json diff --git a/schemamd/testdata/aws_route_table_association.md b/internal/schemamd/testdata/aws_route_table_association.md similarity index 100% rename from schemamd/testdata/aws_route_table_association.md rename to internal/schemamd/testdata/aws_route_table_association.md diff --git a/schemamd/testdata/aws_route_table_association.schema.json b/internal/schemamd/testdata/aws_route_table_association.schema.json similarity index 100% rename from schemamd/testdata/aws_route_table_association.schema.json rename to internal/schemamd/testdata/aws_route_table_association.schema.json diff --git a/schemamd/testdata/awscc_acmpca_certificate.md b/internal/schemamd/testdata/awscc_acmpca_certificate.md similarity index 100% rename from schemamd/testdata/awscc_acmpca_certificate.md rename to internal/schemamd/testdata/awscc_acmpca_certificate.md diff --git a/schemamd/testdata/awscc_acmpca_certificate.schema.json b/internal/schemamd/testdata/awscc_acmpca_certificate.schema.json similarity index 100% rename from schemamd/testdata/awscc_acmpca_certificate.schema.json rename to internal/schemamd/testdata/awscc_acmpca_certificate.schema.json diff --git a/schemamd/testdata/awscc_logs_log_group.md b/internal/schemamd/testdata/awscc_logs_log_group.md similarity index 100% rename from schemamd/testdata/awscc_logs_log_group.md rename to internal/schemamd/testdata/awscc_logs_log_group.md diff --git a/schemamd/testdata/awscc_logs_log_group.schema.json b/internal/schemamd/testdata/awscc_logs_log_group.schema.json similarity index 100% rename from schemamd/testdata/awscc_logs_log_group.schema.json rename to internal/schemamd/testdata/awscc_logs_log_group.schema.json diff --git a/schemamd/write_attribute_description.go b/internal/schemamd/write_attribute_description.go similarity index 100% rename from schemamd/write_attribute_description.go rename to internal/schemamd/write_attribute_description.go diff --git a/schemamd/write_attribute_description_test.go b/internal/schemamd/write_attribute_description_test.go similarity index 98% rename from schemamd/write_attribute_description_test.go rename to internal/schemamd/write_attribute_description_test.go index dc2724af..c1318425 100644 --- a/schemamd/write_attribute_description_test.go +++ b/internal/schemamd/write_attribute_description_test.go @@ -11,7 +11,7 @@ import ( tfjson "github.com/hashicorp/terraform-json" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform-plugin-docs/schemamd" + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" ) func TestWriteAttributeDescription(t *testing.T) { diff --git a/schemamd/write_block_type_description.go b/internal/schemamd/write_block_type_description.go similarity index 100% rename from schemamd/write_block_type_description.go rename to internal/schemamd/write_block_type_description.go diff --git a/schemamd/write_block_type_description_test.go b/internal/schemamd/write_block_type_description_test.go similarity index 98% rename from schemamd/write_block_type_description_test.go rename to internal/schemamd/write_block_type_description_test.go index 16183303..0ee14a26 100644 --- a/schemamd/write_block_type_description_test.go +++ b/internal/schemamd/write_block_type_description_test.go @@ -9,7 +9,8 @@ import ( "github.com/google/go-cmp/cmp" tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-docs/schemamd" + + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" ) func TestWriteBlockTypeDescription(t *testing.T) { diff --git a/schemamd/write_nested_attribute_type_description.go b/internal/schemamd/write_nested_attribute_type_description.go similarity index 100% rename from schemamd/write_nested_attribute_type_description.go rename to internal/schemamd/write_nested_attribute_type_description.go diff --git a/schemamd/write_nested_attribute_type_description_test.go b/internal/schemamd/write_nested_attribute_type_description_test.go similarity index 97% rename from schemamd/write_nested_attribute_type_description_test.go rename to internal/schemamd/write_nested_attribute_type_description_test.go index c576f2df..170284c1 100644 --- a/schemamd/write_nested_attribute_type_description_test.go +++ b/internal/schemamd/write_nested_attribute_type_description_test.go @@ -9,8 +9,9 @@ import ( "github.com/google/go-cmp/cmp" tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-docs/schemamd" "github.com/zclconf/go-cty/cty" + + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" ) func TestWriteNestedAttributeTypeDescription(t *testing.T) { diff --git a/schemamd/write_type.go b/internal/schemamd/write_type.go similarity index 100% rename from schemamd/write_type.go rename to internal/schemamd/write_type.go diff --git a/schemamd/write_type_test.go b/internal/schemamd/write_type_test.go similarity index 95% rename from schemamd/write_type_test.go rename to internal/schemamd/write_type_test.go index 2256b370..3def2586 100644 --- a/schemamd/write_type_test.go +++ b/internal/schemamd/write_type_test.go @@ -11,7 +11,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform-plugin-docs/schemamd" + "github.com/hashicorp/terraform-plugin-docs/internal/schemamd" ) func TestWriteType(t *testing.T) {