-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add information for cross-major-version aliases #3881
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. New resources:
New functions:
|
67dd6b3
to
cb4bfaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a great improvement. Especially v2.yaml!
Only suggestion in addition to the comments: there are a lot of new map accesses without an , ok
guard. Also one slice[0]
without length check. Even if the existence of these elements is an invariant, I'd feel better about checking and asserting the invariant instead of failing in hard-to-debug ways later.
provider/pkg/openapi/discover.go
Outdated
@@ -191,13 +191,31 @@ func NewVersionResources() VersionResources { | |||
|
|||
type ModuleVersionList = map[ModuleName][]ApiVersion | |||
|
|||
// Can only by "Resource" or "Invoke" | |||
type DefinitionType string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not loving the name "definition" yet because the spec also has type definitions but these are not represented here. Don't have a better idea ATM though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Endpoint? URI? Maybe it's just a Resource, but invokes are like read-only resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still recommend some checks when accessing maps but otherwise LGTM
5f58886
to
60136e6
Compare
60136e6
to
cb8ffeb
Compare
cb8ffeb
to
252c003
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3881 +/- ##
==========================================
- Coverage 57.38% 57.26% -0.13%
==========================================
Files 79 78 -1
Lines 12456 12438 -18
==========================================
- Hits 7148 7122 -26
- Misses 4765 4769 +4
- Partials 543 547 +4 ☔ View full report in Codecov by Sentry. |
Instead of mapping to the version string, map to a struct containing the version as well as provenance information.
- Replace the list of resource names (which could also be invoke names) to a map of definition names to the definition's source information. - Change all existing slice iterations with iterating over the sorted keys from the map. - Fix bug where we added empty versions for versions without any definitions. Instead, skip versions with no definitions found.
- Use the original Azure resource provider namespace rather that our adjusted module names which might not match. Add Rp namespace to unit tests This field is now required for active version checking. It's always populated during a real run so we need to add it to tests which hit this path.
DnssecConfig "2018-05-01" and NetworkVirtualApplianceConnection "2023-02-01" don't exist any more, so pick the next closest version that still exists.
- Validate the requested spec additions actually exist. - Avoid duplicating structs and just assign the whole object. Remove unused DefinitionType
- This should never happen in reality, but better to be safe. - Update tests to include resources and the field accessed in the code.
- Use preview-aware sorting. - Pass sets around instead of converting to and from arrays.
- Remove unused `collections.OrderedKeys`. - Utilise `UnsortedKeys` in `SortedKeys`. - Add new `MapOrdered` function to returns an iterator with both the key and value so we can reduce some noise.
- Add a few extra map existence checks too.
- Use util.MapOrdered where possible, or otherwise util.SortedKeys which is generic.
- Add unit test to catch this faster next time.
252c003
to
5e22fa1
Compare
This PR has been shipped in release v2.85.0. |
Microsoft.
).