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

Create pipeline stage to generate list of supported resources #1791

Merged
merged 17 commits into from
Sep 14, 2021

Conversation

theunrepentantgeek
Copy link
Member

What this PR does / why we need it:

Generates a report that lists all the resources (and versions) included in the generation run.

How does this PR make you feel:
gif

If applicable:

  • this PR contains tests

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2021

Codecov Report

Merging #1791 (3799969) into master (02bf294) will increase coverage by 0.01%.
The diff coverage is 74.07%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1791      +/-   ##
==========================================
+ Coverage   42.01%   42.03%   +0.01%     
==========================================
  Files         319      320       +1     
  Lines       90719    90773      +54     
==========================================
+ Hits        38117    38157      +40     
- Misses      49244    49257      +13     
- Partials     3358     3359       +1     
Impacted Files Coverage Δ
...rator/pkg/codegen/pipeline/report_type_versions.go 7.69% <ø> (ø)
...r/pkg/codegen/pipeline/report_resource_versions.go 73.58% <73.58%> (ø)
hack/generator/pkg/codegen/code_generator.go 89.50% <100.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02bf294...3799969. Read the comment docs.

@matthchr
Copy link
Member

This is related to #1715

If we had #1715 would we want to keep this? In some ways it gives a nice summary of the resources in each API folder, which is neat. In other ways, it would be covered by #1715 from a "documentation for customers" perspective, because at that point we'd be pointing them at the generated docs and not here.

If you think this should be removed once we have #1715, possibly put a comment someplace indicating that.

// ReportResourceVersionsStageID is the unique identifier of this stage
const ReportResourceVersionsStageID = "reportResourceVersions"

// ReportResourceVersions creates a pipeline stage that removes any wrapper types prior to actual code generation
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't seem right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.


### microsoft.network

v1alpha1api20201101
Copy link
Member

@matthchr matthchr Sep 10, 2021

Choose a reason for hiding this comment

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

Consider bolding this for emphasis?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the only thing on the line, and it's followed by a bullet list, so I don't think it needs further emphasis.

}

// Summarize collates a list of all resources, grouped by package
func (r *ResourceVersionsReport) Summarize(types astmodel.Types) {
Copy link
Member

Choose a reason for hiding this comment

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

This is a style thing, but it feels sorta weird to me to first construct an empty one of these, and then call Summarize on it causing its immediate mutation. You could do all of this in the NewResourceVersionsReport call and then your type is immutable, which feels like a win. This fits especially nicely here because this iteration can't error anyway (which would be a reason to not do it in the New).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. Changed.

}

func (r *ResourceVersionsReport) WriteTo(outputPath string) error {

Copy link
Member

Choose a reason for hiding this comment

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

very minor: You have a newline here but not on the other methods

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@theunrepentantgeek
Copy link
Member Author

I don't think this would necessarily be supplanted by #1715; it would depend on what information is included in the output.

@theunrepentantgeek theunrepentantgeek merged commit 5eba24e into master Sep 14, 2021
@theunrepentantgeek theunrepentantgeek deleted the feature/resources-report branch September 14, 2021 05:02
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.

5 participants