Emulate Native Types like Lists and Dictionaries via Proxy Objects #1841
Labels
closed-for-staleness
effort/large
Large work item – several weeks of effort
feature-request
A feature should be added or improved.
module/kernel
Issues affecting the `jsii-kernel` module
module/runtime
Issues affecting the `jsii-runtime`
p2
🚀 Feature Request
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)General Information
Description
For cdktf there's the use case of having to support complex computed types. These are lists and dictonaries, which reference attributes not supplied by a user.
cdktf
has to provide a way to reference these attributes, with the following goals in mind:jsii
compatibleExample:
The acm cert validation resource has a
domainValidationOptions
attribute, which is a list ofAcmCertificateDomainValidationOptions
:What I'm looking for, is a way to provide a way to access these attributes which feels natural to the user of the given language. In Typescript this would be something like
certValidation.domainValidationOptions[0].resourceRecordName
.In Typescript, this could be achieved with a proxy object. However, there's no way to represent this in
jsii
at the moment.The current implementation in
cdktf
makes the above example accessible like this:certValidation.domainValidationOptions('0').resourceRecordName
(the string type will likely be replaced by number) and returns a reference like thisacm_certificate.domain_validation_options.0.resourceRecord
. That's close to our ideal requirements, but lacks the idiomatic aspect.Proposed Solution
Not sure how this could be achieved in a way which supports all target languages. In particular, since only Python seems to have a similar way of using proxy objects to emulate native types like lists and dictionaries.
The text was updated successfully, but these errors were encountered: