dart-lang / macros

A Dart mono-repo for macro development.
BSD 3-Clause "New" or "Revised" License
60 stars 5 forks source link

Support for nested collections in schema generator #92

Closed jakemac53 closed 4 days ago

jakemac53 commented 5 days ago

I wanted to add a property of type Map<String, List<Augmentation>> but this doesn't work today. It is pretty trivial to get the generator in a state where it will at least not crash, but the getters it generates in the extension types just call .cast() on the map which won't work for the values, which also need to be casted.

We might need our own map implementation for this to do lazy deep casting, I don't see any appropriate methods on Map to support it (.map could work but it wouldn't be lazy).

davidmorgan commented 5 days ago

After #76 one Augmentation already contains a List<Code>, maybe that gives you enough flexibility to not need an outer List?

Agreed re: casting. Seems okay to add if it looks useful, we can always revisit.

Thanks.