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

Read in descriptions for nested properties #1798

Merged
merged 8 commits into from
Mar 29, 2024

Conversation

guineveresaenger
Copy link
Contributor

@guineveresaenger guineveresaenger commented Mar 27, 2024

Uses a nested path lookup for properties whose descriptions come to us via entityDocs.Attributes.

Allows for the regex to match against . in nested output names.

Fixes #1774.

This is a draft so far as there's a few issues here.

update: Please see a build of the AWS provider docs, for a schema built with these changes where specific missing fields are now correctly populated:

MQ Broker Instance before
MQ Broker Instance after

Lambda Function Snapstart Before
Lambda Function Snapstart After

Elasticsearch DomainVPCOptions Before
Elasticsearch DomainVPCOptions After

** Notes**

  1. I discovered that a majority of nested property descriptions (at least in AWS) come from what is described as a "fallback" in the code comment, which I edited to add that information.

  2. This fixes this bug where extra bullet points in a property description were attached to the previously-parsed entry.

Before:

image
Screenshot 2024-03-26 at 5 33 34 PM

After (localhost):

Screenshot 2024-03-26 at 5 33 22 PM Screenshot 2024-03-26 at 5 33 00 PM

3. However, this may need some more work to properly map multi-nested documentation as seen in mq_broker.instances which still results in missing descriptions on our end

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

This looks directionally good.

pkg/tfgen/docs.go Outdated Show resolved Hide resolved
pkg/tfgen/docs.go Outdated Show resolved Hide resolved
pkg/tfgen/docs.go Outdated Show resolved Hide resolved
pkg/tfgen/docs.go Outdated Show resolved Hide resolved
@guineveresaenger guineveresaenger marked this pull request as ready for review March 27, 2024 23:45
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.24%. Comparing base (3a2ed13) to head (0117474).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1798      +/-   ##
==========================================
- Coverage   60.60%   60.24%   -0.37%     
==========================================
  Files         303      310       +7     
  Lines       42348    42682     +334     
==========================================
+ Hits        25667    25713      +46     
- Misses      15208    15496     +288     
  Partials     1473     1473              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@guineveresaenger guineveresaenger requested review from iwahbe and a team March 28, 2024 16:02
Comment on lines +973 to +975
func flattenListAttributeKey(attribute string) string {
return strings.ReplaceAll(attribute, ".0", "")
}
Copy link
Member

Choose a reason for hiding this comment

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

Where do these lists come from? Are they always .0, never .N or .1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an example of a TF schema.TypeList which I believe only ever uses the .0 to access the list elements. I'm admittedly a bit fuzzy on this so I'm happy to be corrected here.
I also searched the p-aws schema as well as upstream/website for any indications of !=.0 and came up with nothing. I know that's not proof and if you want to make this digit-agnostic, we can.

Copy link
Member

Choose a reason for hiding this comment

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

I trust your check. This is the type of information that would make an excellent comment on line 974.

pkg/tfgen/docs_test.go Show resolved Hide resolved
pkg/tfgen/generate.go Show resolved Hide resolved
@iwahbe iwahbe self-requested a review March 29, 2024 10:25
@guineveresaenger guineveresaenger merged commit eda81ba into master Mar 29, 2024
9 checks passed
@guineveresaenger guineveresaenger deleted the guin/fix-nested-attributes-docs branch March 29, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some property descriptions missing from nested type fields
2 participants