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 incorrect module tokens generated for nested types (issue 611) #622

Merged
merged 10 commits into from
Oct 12, 2022

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Oct 7, 2022

Fixes #611

Removes a TODO from 2018.

Where possible, string replaced with tokens.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.

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-azuread with merge commit 578b994

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-random with merge commit 578b994

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-gcp with merge commit 578b994

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-random with merge commit 5e43c48

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-azuread with merge commit 5e43c48

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-azure with merge commit 578b994

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-gcp with merge commit 5e43c48

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-azure with merge commit 5e43c48

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Diff for pulumi-aws with merge commit 578b994

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

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 {
Copy link
Contributor

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?

Copy link
Contributor

@viveklak viveklak left a 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!

@github-actions
Copy link

Diff for pulumi-random with merge commit 3eac71a

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 3eac71a

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 3eac71a

@github-actions
Copy link

Diff for pulumi-azure with merge commit 3eac71a

@github-actions
Copy link

Diff for pulumi-aws with merge commit 3eac71a

@t0yv0 t0yv0 changed the base branch from master to t0yv0/repro-611 October 12, 2022 18:22
@@ -213,7 +213,7 @@
"values"
]
},
"aws:x/getPolicyDocumentStatement:getPolicyDocumentStatement": {
"aws:x/iam/getPolicyDocumentStatement:getPolicyDocumentStatement": {
Copy link
Member Author

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.

@github-actions
Copy link

Diff for pulumi-random with merge commit cb29052

@github-actions
Copy link

Diff for pulumi-azuread with merge commit cb29052

@github-actions
Copy link

Diff for pulumi-gcp with merge commit cb29052

@github-actions
Copy link

Diff for pulumi-azure with merge commit cb29052

@github-actions
Copy link

Diff for pulumi-aws with merge commit cb29052

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 282aa7c

@github-actions
Copy link

Diff for pulumi-aws with merge commit 282aa7c

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 5bc5c79

@github-actions
Copy link

Diff for pulumi-random with merge commit 5bc5c79

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 7d2a99f

@github-actions
Copy link

Diff for pulumi-azure with merge commit 7d2a99f

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 5bc5c79

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 4c217ab

@github-actions
Copy link

Diff for pulumi-random with merge commit 4c217ab

@github-actions
Copy link

Diff for pulumi-azure with merge commit 5bc5c79

@github-actions
Copy link

Diff for pulumi-aws with merge commit 7d2a99f

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 4218834

@github-actions
Copy link

Diff for pulumi-random with merge commit 4218834

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 4218834

@github-actions
Copy link

Diff for pulumi-azure with merge commit 4218834

@github-actions
Copy link

Diff for pulumi-aws with merge commit 4218834

@t0yv0 t0yv0 merged commit 89c3438 into t0yv0/repro-611 Oct 12, 2022
@t0yv0 t0yv0 deleted the t0yv0/fix-611-b branch October 12, 2022 21:54
t0yv0 added a commit that referenced this pull request Oct 17, 2022
* 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>
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.

Inclusion of a / in a datasources module name produces incorrect tokens in schema.json for children properties
2 participants