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

Provide support for property conversions of JSON properties #1574

Merged
merged 6 commits into from
Jun 18, 2021

Conversation

theunrepentantgeek
Copy link
Member

@theunrepentantgeek theunrepentantgeek commented Jun 17, 2021

What this PR does / why we need it:

We have properties of type v1.JSON but they were not supported by the property conversions needed for storage variants.

At the same time, we generalized two existing property converters to allow support for known types to be easily added.

How does this PR make you feel:
gif

If applicable:

  • this PR contains tests

@@ -30,6 +30,7 @@ var (
ControllerRuntimeAdmission = MakeExternalPackageReference("sigs.k8s.io/controller-runtime/pkg/webhook/admission")
GitHubErrorsReference = MakeExternalPackageReference("github.com/pkg/errors")


Copy link
Member

Choose a reason for hiding this comment

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

minor: Extra newline here

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 by go fmt

)

type Person struct {
KnownReference genruntime.KnownResourceReference `json:"known-reference"`
Copy link
Member

Choose a reason for hiding this comment

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

minor: This should probably be knownReference in the JSON (even though it doesn't matter at all)

@codecov-commenter
Copy link

codecov-commenter commented Jun 18, 2021

Codecov Report

Merging #1574 (ef865a6) into master (ac7b7b1) will decrease coverage by 0.02%.
The diff coverage is 52.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1574      +/-   ##
==========================================
- Coverage   63.43%   63.41%   -0.03%     
==========================================
  Files         181      181              
  Lines       11796    11797       +1     
==========================================
- Hits         7483     7481       -2     
- Misses       3644     3648       +4     
+ Partials      669      668       -1     
Impacted Files Coverage Δ
.../generator/pkg/conversions/property_conversions.go 78.46% <48.64%> (-1.75%) ⬇️
...erator/pkg/astmodel/conversion_function_builder.go 82.55% <100.00%> (ø)
...generator/pkg/codegen/pipeline_create_arm_types.go 67.71% <100.00%> (ø)
.../pkg/codegen/pipeline_replace_anytype_with_json.go 90.47% <100.00%> (ø)
hack/generator/pkg/astmodel/types.go 57.77% <0.00%> (+2.22%) ⬆️
...tor/pkg/conversions/property_conversion_context.go 91.17% <0.00%> (+5.88%) ⬆️

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 ac7b7b1...ef865a6. Read the comment docs.

@theunrepentantgeek theunrepentantgeek merged commit a6df6c7 into master Jun 18, 2021
@theunrepentantgeek theunrepentantgeek deleted the fix/json-properties branch June 18, 2021 06:47
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.

4 participants