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

Chore: ensure that exported Construct have a defaultChild #4557

Closed
2 tasks
nmussy opened this issue Oct 17, 2019 · 1 comment
Closed
2 tasks

Chore: ensure that exported Construct have a defaultChild #4557

nmussy opened this issue Oct 17, 2019 · 1 comment
Assignees
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. package/awscl Cross-cutting issues related to the AWS Construct Library

Comments

@nmussy
Copy link
Contributor

nmussy commented Oct 17, 2019

All construct should expose a defaultChild property (either by setting the node.defaultChild property, or by having a child named Default or Resource). If there are constructs where a defaultChild doesn't make sense(I can't find an example off the top of my head), a specific error type should be thrown.

Use Case

To avoid issues like #4455, #4188, #3314

Proposed Solution

This is something that might be handled by awslint

EDIT: I briefly tried looking into it, but couldn't find a way to do static analysis on function bodies with jsii-reflect. Am I missing something or is it not supported yet?

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@nmussy nmussy added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 17, 2019
@nmussy
Copy link
Contributor Author

nmussy commented Oct 17, 2019

A possible improvement to the defaultChild getter method would be to return the child if there is only one? This would cover most missing cases I imagine.

@SomayaB SomayaB added the @aws-cdk/core Related to core CDK functionality label Oct 17, 2019
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Oct 30, 2019
@eladb eladb added package/awscl Cross-cutting issues related to the AWS Construct Library effort/medium Medium work item – several days of effort labels Jan 23, 2020
@eladb eladb closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. package/awscl Cross-cutting issues related to the AWS Construct Library
Projects
None yet
Development

No branches or pull requests

3 participants