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

Flattening #1548

Merged
merged 49 commits into from
Jun 27, 2021
Merged

Flattening #1548

merged 49 commits into from
Jun 27, 2021

Conversation

Porges
Copy link
Member

@Porges Porges commented Jun 2, 2021

Closes #1447

What this PR does / why we need it:

Applies the x-ms-client-flatten attribute when it is present in the Swagger.

Special notes for your reviewer:

Highly recommend reviewing ignoring whitespace.

How does this PR make you feel:
gif

If applicable:

  • this PR contains documentation
  • this PR contains tests

Taskfile.yml Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2021

Codecov Report

Merging #1548 (969588e) into master (9f78d9e) will decrease coverage by 0.90%.
The diff coverage is 38.52%.

❗ Current head 969588e differs from pull request most recent head 72b594e. Consider uploading reports for the commit 72b594e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1548      +/-   ##
==========================================
- Coverage   63.26%   62.36%   -0.91%     
==========================================
  Files         184      186       +2     
  Lines       11926    12256     +330     
==========================================
+ Hits         7545     7643      +98     
- Misses       3707     3926     +219     
- Partials      674      687      +13     
Impacted Files Coverage Δ
...ted/pkg/reconcilers/azure_deployment_reconciler.go 56.07% <ø> (ø)
hack/generator/pkg/astbuilder/conditions.go 0.00% <0.00%> (ø)
hack/generator/pkg/astmodel/arm_spec_interface.go 91.39% <0.00%> (ø)
hack/generator/pkg/astmodel/array_type.go 88.23% <0.00%> (ø)
.../generator/pkg/astmodel/code_generation_context.go 46.15% <0.00%> (ø)
hack/generator/pkg/astmodel/map_type.go 91.66% <0.00%> (ø)
hack/generator/pkg/astmodel/package_definition.go 25.88% <0.00%> (ø)
hack/generator/pkg/astmodel/reference_graph.go 55.81% <0.00%> (ø)
hack/generator/pkg/astmodel/types.go 57.29% <0.00%> (-1.85%) ⬇️
...enerator/pkg/codegen/pipeline/flatten_resources.go 48.64% <ø> (ø)
... and 28 more

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 9f78d9e...72b594e. Read the comment docs.

@Porges Porges marked this pull request as ready for review June 8, 2021 22:20
@matthchr
Copy link
Member

This will probably have conflicts with #1556 - we should coordinate.

Copy link
Member

@matthchr matthchr left a comment

Choose a reason for hiding this comment

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

I think the core of this came out pretty clean actually, nice!

Copy link
Member

@babbageclunk babbageclunk left a comment

Choose a reason for hiding this comment

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

I'm with Matt, this came out really cleanly! Lots of questions but I think those are just getting my head around what's going on rather than problems.

hack/generator/pkg/astmodel/armconversion/shared.go Outdated Show resolved Hide resolved
@@ -142,7 +142,9 @@ func (codeGenContext *CodeGenerationContext) GetAllReachableTypes() Types {
for _, pkgImport := range codeGenContext.packageImports.AsSlice() {
types, found := codeGenContext.GetTypesInPackage(pkgImport.packageReference)
if found {
result.AddTypes(types)
for k, v := range types {
Copy link
Member

Choose a reason for hiding this comment

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

Presumably because this can have replacements that change the type the definition points to?

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 can find duplicates, somehow. I didn't think about it too much 🙂

hack/generator/pkg/codegen/pipeline_flatten_properties.go Outdated Show resolved Hide resolved
hack/generator/pkg/codegen/pipeline_flatten_properties.go Outdated Show resolved Hide resolved
hack/generator/pkg/codegen/pipeline_status_augment.go Outdated Show resolved Hide resolved
hack/generator/pkg/codegen/pipeline_status_from_swagger.go Outdated Show resolved Hide resolved
Co-authored-by: Christian Muirhead <christian.muirhead@microsoft.com>
@matthchr matthchr added this to the codegen-alpha-0 milestone Jun 14, 2021
@Porges Porges self-assigned this Jun 22, 2021
@babbageclunk
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Porges Porges merged commit 916430a into master Jun 27, 2021
@Porges Porges deleted the flattening branch June 27, 2021 23:26
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.

Flatten "properties" to avoid unnecessary nesting
5 participants