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

Refine path model and path assumptions #661

Merged
merged 1 commit into from Dec 6, 2022
Merged

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Dec 1, 2022

The paths module is used internally to track where we are in the schema during conversion. This refactors it a bit to simplify the model and introduces an interesting correction that helps clarify the tfgen process.

When allocating a named object type, tfgen actually merges structurally identical entries into a single new named object type. Therefore, several distinct paths in the schema may correspond to a new object type token. This is now explicit via PathSet.

It is interesting whether it is possible for the merging to happen across modules, and which module to place the generated type into if that's the case. I believe it's not possible, but now there is a panic/assert checking for that case.

@@ -135,12 +131,16 @@ func (nt *schemaNestedTypes) declareType(path *paths.TypePath,
requiredOutputs = required
}

// Merging makes sure that structurally identical types are shared and not generated more than once.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the interesting bit in the tfgen algorithm! Adding a comment to highlight it.

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-azuread with merge commit 21b31d5

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-random with merge commit 21b31d5

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-gcp with merge commit 21b31d5

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-azure with merge commit 21b31d5

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-aws with merge commit 21b31d5

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-azure with merge commit 9364284

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Diff for pulumi-aws with merge commit 9364284

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

Diff for pulumi-random with merge commit 17d4956

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

Diff for pulumi-azuread with merge commit 17d4956

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

Diff for pulumi-gcp with merge commit 17d4956

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

Diff for pulumi-azure with merge commit 17d4956

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

Diff for pulumi-aws with merge commit 17d4956

@t0yv0 t0yv0 mentioned this pull request Dec 2, 2022
@github-actions
Copy link

github-actions bot commented Dec 5, 2022

Diff for pulumi-azuread with merge commit 2dfe1eb

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

Diff for pulumi-random with merge commit 2dfe1eb

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

Diff for pulumi-gcp with merge commit 2dfe1eb

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

Diff for pulumi-azure with merge commit 2dfe1eb

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

Diff for pulumi-aws with merge commit 2dfe1eb

@t0yv0 t0yv0 merged commit 1ad22a8 into master Dec 6, 2022
@t0yv0 t0yv0 deleted the t0yv0/more-precise-paths branch December 6, 2022 17:19
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.

None yet

2 participants