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

fix(python): correctly handle nested structs-as-dict #973

Merged
merged 2 commits into from
Nov 12, 2019

Conversation

RomainMuller
Copy link
Contributor

Added code to up-cast from dict to the relevant struct type in the generated
python code whenever the value type is some unambiguous struct. Whenever
a UNION of types is involved, the user must construct the struct type themselves,
as the runtime would then have no way to choose which type should be used on
it's own without additional information.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Added code to up-cast from `dict` to the relevant struct type in the generated
python code whenever the value type is some unambiguous struct. Whenever
a UNION of types is involved, the user must construct the struct type themselves,
as the runtime would then have no way to choose which type should be used on
it's own without additional information.
@RomainMuller RomainMuller requested review from bmaizels and a team as code owners November 12, 2019 07:14
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

You’ll need to figure out how to write a regression test for this.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@RomainMuller
Copy link
Contributor Author

There is a test

@RomainMuller RomainMuller removed the request for review from bmaizels November 12, 2019 07:38
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Missing test

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Nov 12, 2019

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Nov 12, 2019
@mergify mergify bot merged commit fe9d63e into master Nov 12, 2019
@mergify mergify bot deleted the rmuller/fix-python-nested-structs branch November 12, 2019 08:11
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Nov 12, 2019
RomainMuller added a commit that referenced this pull request Nov 12, 2019
* fix(python): correctly handle nested structs-as-dict

Added code to up-cast from `dict` to the relevant struct type in the generated
python code whenever the value type is some unambiguous struct. Whenever
a UNION of types is involved, the user must construct the struct type themselves,
as the runtime would then have no way to choose which type should be used on
it's own without additional information.

* add None explicit test
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

4 participants