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

Fixes union type conversions to CloudControl #1850

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Nov 25, 2024

This change fixes the conversion of Pulumi input properties to the format expected by the CloudControl API in the case when Pulumi schema specifies a union type (OneOf) without a discriminator. Previously the first matching case would be picked which could erroneously send empty data to CloudControl. With this change a heuristic is run instead to pick the non-error case with the largest map or array.

In the long term it would be better to support discriminators and manage their metadata (#1849).

Fixes #1846

@t0yv0 t0yv0 requested a review from corymhall November 25, 2024 17:34
Copy link
Contributor

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 82.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 47.35%. Comparing base (44239c9) to head (868ca11).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
provider/pkg/naming/convert.go 82.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1850      +/-   ##
==========================================
+ Coverage   47.13%   47.35%   +0.21%     
==========================================
  Files          50       50              
  Lines        7050     7085      +35     
==========================================
+ Hits         3323     3355      +32     
- Misses       3483     3487       +4     
+ Partials      244      243       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This change fixes the conversion of Pulumi input properties to the format expected by the CloudControl API in the case
when Pulumi schema specifies a union type (OneOf) without a discriminator. Previously the first matching case would be
picked which could erroneously send empty data to CloudControl. With this change a heuristic is run instead to pick the
non-error case with the largest map or array.

In the long term it would be better to support discriminators and manage their metadata (#1849).

Fixes #1846
@t0yv0 t0yv0 force-pushed the t0yv0/categorize-refs branch from 4771f98 to 868ca11 Compare November 25, 2024 17:44
@t0yv0 t0yv0 merged commit d5184e5 into master Nov 25, 2024
18 checks passed
@t0yv0 t0yv0 deleted the t0yv0/categorize-refs branch November 25, 2024 19:08
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.

aws-native:datazone:DataSource: Create Datasource fails with "2 subschemas matched instead of one"
2 participants