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

Missing imports in generated Python code #1809

Closed
1 of 4 tasks
RomainMuller opened this issue Jul 22, 2020 · 0 comments · Fixed by #1810
Closed
1 of 4 tasks

Missing imports in generated Python code #1809

RomainMuller opened this issue Jul 22, 2020 · 0 comments · Fixed by #1810
Assignees
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@RomainMuller
Copy link
Contributor

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: 1.9.0 and earlier
  • Platform: all

What is the problem?

When kwargs are lifted from a struct that has parent interfaces, the imports for parent interfaces are not collected and thus are missing from the generated code, potentially rendering it invalid.

This is the root cause of aws/aws-cdk#9052

@RomainMuller RomainMuller added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Jul 22, 2020
@RomainMuller RomainMuller self-assigned this Jul 22, 2020
RomainMuller added a commit that referenced this issue Jul 22, 2020
When a keyword argument was obtained from the super-interface of some
struct, imports required to bring the inherited properties' types in
scope were not emitted due to lack of traversing the struct hierarchies.

Fixes #1809
RomainMuller added a commit that referenced this issue Jul 22, 2020
When a keyword argument was obtained from the super-interface of some
struct, imports required to bring the inherited properties' types in
scope were not emitted due to lack of traversing the struct hierarchies.

Fixes #1809
RomainMuller added a commit that referenced this issue Jul 22, 2020
struct, imports required to bring the inherited properties' types in
scope were not emitted due to lack of traversing the struct hierarchies.

The fix is tested by introducing a method that accepts a kwargs-liftable
argument that extends another struct. Without this fix, tests in
`@jsii/python-runtime` would fail due to being unable to load any of the
modules. A test that expressedly leverages this new class and method was
however introduced for good measure.

Fixes #1809
RomainMuller added a commit that referenced this issue Jul 22, 2020
When a keyword argument was obtained from the super-interface of some
struct, imports required to bring the inherited properties' types in
scope were not emitted due to lack of traversing the struct hierarchies.

The fix is tested by introducing a method that accepts a kwargs-liftable
argument that extends another struct. Without this fix, tests in
`@jsii/python-runtime` would fail due to being unable to load any of the
modules. A test that expressedly leverages this new class and method was
however introduced for good measure.

Fixes #1809
@mergify mergify bot closed this as completed in #1810 Jul 22, 2020
mergify bot pushed a commit that referenced this issue Jul 22, 2020
When a keyword argument was obtained from the super-interface of some
struct, imports required to bring the inherited properties' types in
scope were not emitted due to lack of traversing the struct hierarchies.

The fix is tested by introducing a method that accepts a kwargs-liftable
argument that extends another struct. Without this fix, tests in
`@jsii/python-runtime` would fail due to being unable to load any of the
modules. A test that expressedly leverages this new class and method was
however introduced for good measure.

Fixes #1809



---

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

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant