Skip to content

Conversation

@BBBmau
Copy link
Collaborator

@BBBmau BBBmau commented Nov 14, 2025

implements a helper function first mentioned here:

This moves the logic found within property_documentation.html.markdown.tmpl to its own helper method to handle the type of field when generating documentation (i.e output, write-only, required)

Validation on this is ensuring that we get no diffs when generating the docs

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 ( 3 files changed, 4 insertions(+), 4 deletions(-))
google-beta provider: Diff ( 3 files changed, 4 insertions(+), 4 deletions(-))

mmv1/api/type.go Outdated
return strings.TrimSpace(strings.TrimRight(t.Description, "\n"))
}

func (t *Type) FieldType() string {
Copy link
Member

Choose a reason for hiding this comment

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

This should return a list of strings, which is joined in the template with the join helper, as described in #15385 (review).

Please also add unit tests.

@melinath
Copy link
Member

removing service labels / review request since is a provider-wide change that just makes the docs a little easier to maintain.

@melinath
Copy link
Member

The reason this should return a slice of strings is because we don't want to lock ourselves in to it being a string here; it limits the utility of the function. Additionally, it breaks the separation of concerns: the template is responsible for formatting the data we give it; handling that formatting in a helper method takes that responsibility away from the template (and makes it harder to understand what the final output of the template will be.)

There may be other helper methods that format & return strings to be directly inserted into the template, but that's generally a bad practice and we should remove them over time.

@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 ( 3 files changed, 4 insertions(+), 4 deletions(-))
google-beta provider: Diff ( 3 files changed, 4 insertions(+), 4 deletions(-))

@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 ( 3 files changed, 4 insertions(+), 4 deletions(-))
google-beta provider: Diff ( 3 files changed, 4 insertions(+), 4 deletions(-))

Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

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

This is great, thanks for the thorough unit tests! The docs output does diverge slightly in that it adds "write-only" to things that are in the write-only section at the moment, but that's fine. It doesn't lose information, and your other PR is about to remove that section anyway!

@BBBmau BBBmau added this pull request to the merge queue Nov 14, 2025
Merged via the queue into GoogleCloudPlatform:main with commit 6a6634d Nov 14, 2025
24 checks passed
@BBBmau BBBmau deleted the add-FieldType-helper-docs branch November 14, 2025 22:21
bcreddy-gcp pushed a commit to bcreddy-gcp/magic-modules that referenced this pull request Nov 24, 2025
deliaqi pushed a commit to deliaqi/magic-modules that referenced this pull request Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants