-
Notifications
You must be signed in to change notification settings - Fork 41
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 incorrect module tokens generated for nested types (issue 611) #622
Conversation
Diff for pulumi-azuread with merge commit 578b994 |
Diff for pulumi-random with merge commit 578b994 |
Diff for pulumi-gcp with merge commit 578b994 |
Diff for pulumi-random with merge commit 5e43c48 |
Diff for pulumi-azuread with merge commit 5e43c48 |
Diff for pulumi-azure with merge commit 578b994 |
Diff for pulumi-gcp with merge commit 5e43c48 |
Diff for pulumi-azure with merge commit 5e43c48 |
Diff for pulumi-aws with merge commit 578b994 |
Diff for pulumi-aws with merge commit 5e43c48 |
@@ -908,3 +944,47 @@ func appendExample(description, markdownToAppend string) string { | |||
} | |||
return strings.Join(reassembledLines, "\n") | |||
} | |||
|
|||
func modulePlacementForType(pkg tokens.Package, path *paths.TypePath) tokens.Module { |
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.
This feels like the heart of the change. Lets add some unit tests here since none of the downstream repos actually exhibit the format that would trigger the bug in #611?
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.
Changes look great! Once we add a few more tests here should be good to go!
bdb46b2
to
9629d26
Compare
Diff for pulumi-random with merge commit 3eac71a |
Diff for pulumi-azuread with merge commit 3eac71a |
Diff for pulumi-gcp with merge commit 3eac71a |
Diff for pulumi-azure with merge commit 3eac71a |
Diff for pulumi-aws with merge commit 3eac71a |
9629d26
to
1dbd7d4
Compare
@@ -213,7 +213,7 @@ | |||
"values" | |||
] | |||
}, | |||
"aws:x/getPolicyDocumentStatement:getPolicyDocumentStatement": { | |||
"aws:x/iam/getPolicyDocumentStatement:getPolicyDocumentStatement": { |
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.
@viveklak PTAL - I've rebased this on #624 so now we can see how the changes affect the schema generation. The only diff is visible here is the expected diff - "x" becomes "x/iam". The other types and functions in the schema add some confidence that the rest of the schema generation does not regress.
Diff for pulumi-random with merge commit cb29052 |
Diff for pulumi-azuread with merge commit cb29052 |
Diff for pulumi-gcp with merge commit cb29052 |
Diff for pulumi-azure with merge commit cb29052 |
Diff for pulumi-aws with merge commit cb29052 |
1dbd7d4
to
69612ee
Compare
Diff for pulumi-azuread with merge commit 282aa7c |
Diff for pulumi-aws with merge commit 282aa7c |
Diff for pulumi-azuread with merge commit 5bc5c79 |
Diff for pulumi-random with merge commit 5bc5c79 |
Diff for pulumi-gcp with merge commit 7d2a99f |
ab3cfa5
to
5e9bf14
Compare
Diff for pulumi-azure with merge commit 7d2a99f |
Diff for pulumi-gcp with merge commit 5bc5c79 |
Diff for pulumi-azuread with merge commit 4c217ab |
Diff for pulumi-random with merge commit 4c217ab |
Diff for pulumi-azure with merge commit 5bc5c79 |
Diff for pulumi-aws with merge commit 7d2a99f |
5e9bf14
to
81c4407
Compare
Diff for pulumi-azuread with merge commit 4218834 |
Diff for pulumi-random with merge commit 4218834 |
Diff for pulumi-gcp with merge commit 4218834 |
Diff for pulumi-azure with merge commit 4218834 |
Diff for pulumi-aws with merge commit 4218834 |
* Introduce a test case reproducing 611 * Fix lint, break pkg import cycle * Satisfy lint by removing io/ioutil deprecated dep * Fix diag panic * Fix os.MkdirTemp * Make testing robust to Git windows checkouts with CRLF * Fixes incorrect module tokens generated for nested types (issue 611) (#622) * Switch pkg type from string to tokens.Package * Use tokens.Module instead of string where possible * Add ability to save generated schema * Compute module placement via type gen paths * Undo accidental docs diffs * Simplify diff * Remove debug helpers * Remove diff * Satisfy lint * PULUMI_ACCEPT=1 go test -run TestRegress611 * Review comments * More copyright notices * Add copyright * Document PULUMI_ACCEPT in Makefile Co-authored-by: Vivek Lakshmanan <vivek@lakshmanan.ca>
Fixes #611
Removes a TODO from 2018.
Where possible,
string
replaced withtokens.Module
,tokens.ModuleName
,tokens.Package
, etc. This helps a little with tracking where we have a fully qualified name vs the last token of a mutli-token name, as well as review any strange string manipulations.Added a helper paths module with types to represent schema traversal locations where types are found. While not strictly necessary, it was a great debugging helper as printing it out in any function that accept is as a parameter can quickly localize the work-in-progress relative to schema.