-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow the
Type
override to effect downstream types (#1550)
This PR changes how `tfbridge.SchemaInfo.Type` is interpreted when applied to object properties. Previously, type changed the `schema.TypeSpec.{Type,Ref}` fields on the generated resource. It did not effect any nested types. With this PR, `Type` is interpreted as a command to rename the relevant object and its entire nested structure. This allows multiple fields or objects to share a type definition when specified, and will allow us to reduce the size of our SDKs. --- This is technically a breaking change. Bridge users who have specified `Type: someNewType` on object types will see different behavior. In practice, setting `Type` on an object would generate an invalid schema without a careful fix-up. I suspect that no-one does this. I have tested this change on `pulumi-ns1`, `pulumi-aws`, `pulumi-gcp` and `pulumi-azure`. None of these providers are effected by this change. ### Implementers Notes `paths.TypePath` is used to determine the module of derived types. Since we want subtypes of a moved type to themselves move to the module of their parent, we need to track that in the paths used. To allow inserting a type at an arbitrary module, it was necessary to create a new `paths.TypePath`; `paths.RawTypePath` projects a `tokens.Type` into `paths.TypePath` so it can be used for module discovery.
- Loading branch information
Showing
6 changed files
with
378 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.