feat(lib): add StringMapMap class#110
Conversation
Signed-off-by: OrfeasZ <orfeaz@gmail.com>
jsteinich
left a comment
There was a problem hiding this comment.
It would be nice if we added a couple tests showing that referencing / looking up a property from such a type results in the correct Terraform being synthesized, but existing test coverage for these sort of complex types isn't great.
|
I've removed the redundant check and added a couple of test cases. The generated terraform code seems to match what I'd expect. One more thing: Should I also add classes for other types of nested maps like |
Thanks
We could, but I'm not sure that anything is actually using them, so could be a follow-up PR. |
Related issue
Fixes #10
Description
This was originally sent as a PR against the CDKTF repo by @nikolaymatrosov. I've simply adjusted it for CDKTN and re-submitted here with their permission. Original description follows below:
This PR adds support for
StringMapMaptype to handle provider schemas that define attributes withmap[map[string]]type structure. The yandex-cloud provider (and potentially others) define certain attributes likeairflow_configwith a nested map structure that wasn't previously supported by the CDKTF code generation.The implementation includes:
StringMapMapclass: Added topackages/cdktf/lib/complex-computed-list.tsthat extendsComplexResolvableand provides alookup(key: string): StringMapmethod for accessing nested mapsattribute-type-model.tsto detect when the element type isStringMapand generate the appropriateStringMapMaptype instead of the generic patternThe fix enables users to successfully generate providers that use nested map structures in their schemas, resolving the JSII compilation errors that were preventing provider generation.
Checklist