Skip to content

feat(lib): add StringMapMap class#110

Open
OrfeasZ wants to merge 3 commits intoopen-constructs:mainfrom
OrfeasZ:feat/StringMapMap
Open

feat(lib): add StringMapMap class#110
OrfeasZ wants to merge 3 commits intoopen-constructs:mainfrom
OrfeasZ:feat/StringMapMap

Conversation

@OrfeasZ
Copy link
Copy Markdown

@OrfeasZ OrfeasZ commented Apr 18, 2026

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 StringMapMap type to handle provider schemas that define attributes with map[map[string]] type structure. The yandex-cloud provider (and potentially others) define certain attributes like airflow_config with a nested map structure that wasn't previously supported by the CDKTF code generation.

The implementation includes:

  1. New StringMapMap class: Added to packages/cdktf/lib/complex-computed-list.ts that extends ComplexResolvable and provides a lookup(key: string): StringMap method for accessing nested maps
  2. Provider generator updates: Modified attribute-type-model.ts to detect when the element type is StringMap and generate the appropriate StringMapMap type instead of the generic pattern
  3. Comprehensive tests: Added test fixtures and snapshots to ensure the new functionality works correctly

The 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

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

Signed-off-by: OrfeasZ <orfeaz@gmail.com>
@OrfeasZ OrfeasZ requested a review from a team as a code owner April 18, 2026 16:59
Copy link
Copy Markdown
Collaborator

@jsteinich jsteinich left a comment

Choose a reason for hiding this comment

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

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.

@OrfeasZ
Copy link
Copy Markdown
Author

OrfeasZ commented Apr 19, 2026

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 BooleanMapMap, NumberMapMap and AnyMapMap? I'm not sure if any providers use these and how to check, but might be good to have for future proofing.

@jsteinich
Copy link
Copy Markdown
Collaborator

I've removed the redundant check and added a couple of test cases. The generated terraform code seems to match what I'd expect.

Thanks

One more thing: Should I also add classes for other types of nested maps like BooleanMapMap, NumberMapMap and AnyMapMap? I'm not sure if any providers use these and how to check, but might be good to have for future proofing.

We could, but I'm not sure that anything is actually using them, so could be a follow-up PR.

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.

Provider bindings reference non-existent StringMapMap

3 participants