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

Add field-level metadata generation for mmv1 resources #12792

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

roaks3
Copy link
Contributor

@roaks3 roaks3 commented Jan 17, 2025

This is the initial pass at adding field metadata to all mmv1 resources. I was able to check a small set of resources for accuracy, but further accuracy improvements are expected to come after we have the data ingested and can more clearly run checks.

Notable decisions:

  • I chose to have the api_field default to the value of field when it isn't specified, so that it does not need to be included for the vast majority of fields. This massively reduces the size and visual noise in metadata files, which will be helpful for handwritten resources later.
  • We do not generate explicit key/value metadata fields for maps, even though that is how they are described in the API, because it isn't meaningful for coverage. Maps are treated like a single field.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.


@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 511 files changed, 24143 insertions(+))
google-beta provider: Diff ( 589 files changed, 27612 insertions(+))

@roaks3 roaks3 requested a review from melinath January 17, 2025 17:09
func (r Resource) LeafProperties() []*Type {
types := r.AllNestedProperties(google.Concat(r.RootProperties(), r.UserVirtualFields()))

// Remove types that have children, becasue we only want "leaf" fields
Copy link
Member

Choose a reason for hiding this comment

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

sp - feel free to ignore

Suggested change
// Remove types that have children, becasue we only want "leaf" fields
// Remove types that have children, because we only want "leaf" fields

@@ -198,3 +198,105 @@ func TestResourceServiceVersion(t *testing.T) {
})
}
}

func TestLeafProperties(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

would it be useful to have tests for non-nested leaf properties to cover the base case?

Comment on lines +8 to +9
-
field: '{{ $p.MetadataLineage }}'
Copy link
Member

Choose a reason for hiding this comment

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

I think this newline isn't necessary / isn't how we generally format our yaml. It adds a lot of whitespace to the yaml file.

Suggested change
-
field: '{{ $p.MetadataLineage }}'
- field: '{{ $p.MetadataLineage }}'

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.

3 participants