Skip to content

Strongly type ApiVersion and SdkVersion#3753

Merged
danielrbradley merged 4 commits into
masterfrom
typed-versions
Dec 6, 2024
Merged

Strongly type ApiVersion and SdkVersion#3753
danielrbradley merged 4 commits into
masterfrom
typed-versions

Conversation

@danielrbradley

@danielrbradley danielrbradley commented Dec 5, 2024

Copy link
Copy Markdown
Contributor
  • Rename packageGenerator.apiVersion to packageGenerator.sdkVersion.
  • Rename packageGenerator.allApiVersions to packageGenerator.allSdkVersions.
  • Add packageGenerator.apiVersion as pointer to an ApiVersion, if we can convert it.
  • Add collections.OrderableSet as replacement for codegen.StringSet which allows for non-string types.
  • Document where a string can be either API or SDK versions and is therefore remaining a string for now.
  • Fix type mismatch in ShouldInclude with the RemovedVersions file which included removed versions in the description.

@danielrbradley danielrbradley self-assigned this Dec 5, 2024
@github-actions

github-actions Bot commented Dec 5, 2024

Copy link
Copy Markdown
Contributor

Does the PR have any schema changes?

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

@codecov

codecov Bot commented Dec 5, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 76.02740% with 35 lines in your changes missing coverage. Please review.

Project coverage is 56.92%. Comparing base (5a1321b) to head (64156d6).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
provider/pkg/versioning/gen.go 0.00% 10 Missing ⚠️
provider/pkg/collections/maps.go 0.00% 7 Missing ⚠️
provider/pkg/gen/schema.go 85.29% 4 Missing and 1 partial ⚠️
provider/pkg/openapi/discover.go 86.95% 3 Missing ⚠️
provider/pkg/collections/orderableSet.go 90.90% 2 Missing ⚠️
provider/pkg/openapi/versioner.go 80.00% 1 Missing and 1 partial ⚠️
provider/pkg/versioning/defaultVersion.go 90.00% 1 Missing and 1 partial ⚠️
provider/pkg/versioning/specs.go 33.33% 2 Missing ⚠️
provider/pkg/versioning/build_schema.go 0.00% 1 Missing ⚠️
provider/pkg/versioning/deprecations.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3753   +/-   ##
=======================================
  Coverage   56.92%   56.92%           
=======================================
  Files          74       76    +2     
  Lines       11841    11877   +36     
=======================================
+ Hits         6740     6761   +21     
- Misses       4610     4624   +14     
- Partials      491      492    +1     

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

Comment thread provider/pkg/versioning/gen.go Outdated

@thomas11 thomas11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great readability improvement! One comment about potentially passing the wrong kind of version needs to be resolved, the others are "should have".

Comment thread provider/pkg/gen/schema.go
Comment thread provider/pkg/gen/schema.go Outdated
Comment thread provider/pkg/gen/schema.go Outdated
Comment thread provider/pkg/versioning/findNewerVersions.go Outdated
Make the type aliases into type definitions.

Renames:
- packageGenerator.apiVersion to packageGenerator.sdkVersion
- packageGenerator.allApiVersions to packageGenerator.allSdkVersions

Add packageGenerator.apiVersion as pointer to an ApiVersion, if we can convert it.

Add OrderableSet as replacement for codegen.StringSet

Fix all references.
Fix tests where we were using the wrong type of version.
- Clarify existing comment.
- Switch TODO to an explanation.
- Ensure we always have API version for non-default versions and error if not.
- Move version nil check into ShouldInclude.
Fix handling of "-beta" versions when converting back from SDK version to API version.
@danielrbradley danielrbradley merged commit 04edaa3 into master Dec 6, 2024
@danielrbradley danielrbradley deleted the typed-versions branch December 6, 2024 12:39
danielrbradley added a commit that referenced this pull request Dec 6, 2024
Fixes #3424

Before considering the resources marked for removal, if the resource
version was in the previous default version, ensure we include it.

Only fix this for v3 onwards so we don't introduce schema changes now.

Bonus:
- Fix handling of "-beta" versions when converting back from SDK version
to API version.

Stacked on top of #3753
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v2.76.0.

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.

3 participants