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

Custom jumpo type sunset #744

Merged
merged 3 commits into from
Jul 19, 2022
Merged

Custom jumpo type sunset #744

merged 3 commits into from
Jul 19, 2022

Conversation

pawelprazak
Copy link
Contributor

@pawelprazak pawelprazak commented Jul 14, 2022

Description

Use @CustomType.Builder in codegen.

Part of #390

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@pawelprazak pawelprazak requested review from t0yv0 and dixler July 14, 2022 12:48
// optionalAsNull is used in conjunction with the `typeString` parameter
// `outerOptional` to ensure types line up.
// In general, `outerOptional` <=> `!optionalAsNull`.
func emptyTypeInitializer(ctx *classFileContext, t schema.Type, optionalAsNull bool) string {
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a win to me! I had doubts this is fully corret in all cases.

} public CompositePathResponse build() {
return new CompositePathResponse(order, path);
}
public CompositePathResponse build() {
Copy link
Member

Choose a reason for hiding this comment

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

Looking good! So this removed the situation with "too many constructors".

Observing that since class fields are no longer final, it's possible to shorten the builder code further by keeping an instance of the class.

    @CustomType.Builder
    public static final class Builder {
        private @Nullable CompositePathResponse $;
    }
    @CustomType.Setter
    public Builder path(@Nullable String path) {
         $.path = path;
         return this;
    }
    public CompositePathResponse build() {
        return $;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, correct, I've noticed it too, just didn't want to make unrelated changes

@@ -773,6 +773,9 @@
},
"bar256": {
"type": "string"
},
"default": {
Copy link
Member

Choose a reason for hiding this comment

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

Curious why add this one? To test name mangling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I wanted to test the default -> default_ and that one or the other will appear in all the correct places

@t0yv0 t0yv0 requested review from a team and removed request for a team July 18, 2022 14:18
Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@pawelprazak pawelprazak merged commit 9062a43 into main Jul 19, 2022
@pulumi-bot pulumi-bot deleted the pprazak/390/custom-jumbo-type branch July 19, 2022 07:45
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.

2 participants