Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate: Prevent incorrect attribute association with very deep nesting #382

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jun 3, 2024

Closes #380

After introducing the new unit test matching the given schema and expected output, prior to the logic change:

--- FAIL: TestRender (0.00s)
    --- FAIL: TestRender/deep_nested_attributes (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-docs/internal/schemamd/render_test.go:91: Unexpected diff (-wanted, +got):   strings.Join({
              	... // 1062 identical bytes
              	"el_two.level_three.level_four_primary. (see [below for nested sc",
              	"hema](#nestedatt--level_one--level_two--level_three--level_four_",
            - 	"prim",
            + 	"second",
              	"ary--level_five))\n- `level_four_primary_string` (String) Parent ",
              	"should be level_one.level_two.level_three.level_four_primary.\n\n<",
              	`a id="nestedatt--level_one--level_two--level_three--level_four_`,
            - 	"prim",
            + 	"second",
              	"ary--level_five\"></a>\n### Nested Schema for `level_one.level_two",
              	".level_three.level_four_",
            - 	"prim",
            + 	"second",
              	"ary.level_five`\n\nOptional:\n\n- `level_five_string` (String) Paren",
              	"t should be level_one.level_two.level_three.level_four_primary.l",
              	"evel_five.",
              }, "")

Reference: #380

After introducing the new unit test matching the given schema and expected output, prior to the logic change:

```
--- FAIL: TestRender (0.00s)
    --- FAIL: TestRender/deep_nested_attributes (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-docs/internal/schemamd/render_test.go:91: Unexpected diff (-wanted, +got):   strings.Join({
              	... // 1062 identical bytes
              	"el_two.level_three.level_four_primary. (see [below for nested sc",
              	"hema](#nestedatt--level_one--level_two--level_three--level_four_",
            - 	"prim",
            + 	"second",
              	"ary--level_five))\n- `level_four_primary_string` (String) Parent ",
              	"should be level_one.level_two.level_three.level_four_primary.\n\n<",
              	`a id="nestedatt--level_one--level_two--level_three--level_four_`,
            - 	"prim",
            + 	"second",
              	"ary--level_five\"></a>\n### Nested Schema for `level_one.level_two",
              	".level_three.level_four_",
            - 	"prim",
            + 	"second",
              	"ary.level_five`\n\nOptional:\n\n- `level_five_string` (String) Paren",
              	"t should be level_one.level_two.level_three.level_four_primary.l",
              	"evel_five.",
              }, "")
```
@bflad bflad added the bug Something isn't working label Jun 3, 2024
@bflad bflad added this to the v0.20.0 milestone Jun 3, 2024
@bflad bflad requested a review from a team as a code owner June 3, 2024 16:30
Copy link
Contributor

@SBGoods SBGoods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Can't wait for the opportunity for us to refactor schemamd.

@bflad bflad modified the milestones: v0.20.0, v0.19.4 Jun 3, 2024
@bflad bflad merged commit 3870756 into main Jun 3, 2024
7 checks passed
@bflad bflad deleted the bflad/multiple-nested-attributes branch June 3, 2024 21:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect labels in generated markdown for certain deeply-nested schemas
2 participants