-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fn.conditionIf(...).toString() fails to serialize in Java #1984
Fn.conditionIf(...).toString() fails to serialize in Java #1984
Comments
Here's a minimal example comparing CDK 0.21.0 to 0.25.2: |
I've seen this issue as well after upgrading to 0.25. |
Expose the underlying `toString` in the `IConditionExpression` interface so they can be embedded as string values in jsii languages. Fixes #1984
Fix: #2007 |
Expose the underlying `toString` in the `IConditionExpression` interface so they can be embedded as string values in jsii languages. Fixes #1984
I have the same issue on version 0.22.x, I would like to have .toString() interface which can return either the value in true condition or false condition. Has it been fixed? Which version the issue was fixed? |
It will be released this week. |
In CDK for Java 0.21.0, the
FnIf
condition extendsToken
, providing an implementation oftoString()
that performs as I expect: rendering the if-condition as a CloudFormation token string:After v0.21.0, specifically in the latest version 0.25.2, the new
Fn.conditionIf
method returns anIConditionExpression
which does not extendToken
or implementtoString()
. As such, when callingtoString()
on the result ofFn.conditionIf
, which is required to pass the result of the condition to any "props" that expects aString
, serializes the Java object directly:This makes CDK >0.21.0 unusable from Java if your stack expects to use "Fn::If". I believe that feat: cloudformation condition chaining (#1494) switched from returning an
FnCondition
, which extendedCloudFormationToken
, to returningIConditionExpression
. Instead, it should simply have returnedFnConditionBase
,CloudFormationToken
, or even justString
.The text was updated successfully, but these errors were encountered: