-
Notifications
You must be signed in to change notification settings - Fork 247
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
Python generated construct failure in deserialization - AVP L2 CDK Constructs #4593
Comments
As discussed, the error is because It needs use |
@reste85: I think in this case we want |
If that's the case you could add a |
The following code does work from a jsii perspective, but fails due to a bug in the package code:
|
In this line, you are converting a behavioral interface to a struct. That works in TS, because duck-typing. But it fails in jsii. And here you are doing the opposite, but this happens to work because that part of the code never crosses the jsii boundary: Sorry jsii doesn't warn you about this. If it can, it probably should. You might also want to look into integration testing your jsii packages. |
Don't do this, but for any one interested you can actually make this work. You "just" have to implement the conversion on the Python side as well. Key parts here are:
|
This issue is now closed. Comments on closed issues are hard for our team to see. |
Removing I notation from props interfaces, in order to be considered as struct by JSII. This solves Python problems of our Constructs that have been addressed thanks to the JSII team in the following issue aws/jsii#4593 BREAKING CHANGE: this introduces breaking changes since some property classes of constructs have been changed
Describe the bug
Hello everyone,
I'm one of the authors of https://github.com/cdklabs/cdk-verified-permissions, which are a set of L2 CDK Constructs for Amazon Verified Permissions. I'm experiencing an error while using that constructs library in Python especially the
PolicyStore
construct. You can see the definition of that construct here: https://github.com/cdklabs/cdk-verified-permissions/blob/main/src/policy-store.ts. The main point is that when i try to create a PolicyStore providingvalidation_settings
argument as Python dict i receive a deserialization error. It seems that the property is not recognized even if i'm passing a dictionary containing all the required elementsExpected Behavior
Create a
PolicyStore
without problems and with the minimum required parametersCurrent Behavior
Deserialization error:
Reproduction Steps
Possible Solution
No response
Additional Information/Context
I know that this could depends by the code in the construct library. But the behaviour seems very strange (especially due to the fact that we're seeing passing dictionaries as properties in Python for other CDK L2 Constructs and there are no problems at all) and we would like to understand if it is something related to our code (so we need to fix it) or if it's due to a potential bug in JSII.
Please note:
PolicyStore
, more specifically the error happens related to entering fields for validation_settings propertySDK version used
constructs compiled with jsii-compiler 5.2 and also 5.4
Environment details (OS name and version, etc.)
Local Machine MacOS Ventura, Python version 3.12.4
The text was updated successfully, but these errors were encountered: