Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
8 stars 28 forks source link

Add linter rule for anonymous models #431

Open catalinaperalta opened 3 months ago

catalinaperalta commented 3 months ago

It would be great to have a linter rule call out anonymous models to help service teams avoid them as they define their spec, since this causes issues with the emitters later on. Based on this previous issue https://github.com/Azure/typespec-azure-pr/issues/2367 seems it is hard to catch all cases of anonymous models and this linter rule cannot warn for every case, but it would be useful to try to catch common scenarios where anonymous models cause issues for emitters, such as inline anonymous models passed into the standard templates.

catalinaperalta commented 3 months ago

After talking to @timotheeguerin, seems like these might be best added as part of TCGC linter rules. If so, we'd need to have azure specs extend those linter rules as well. This issue could help with how we extend these additional rules: https://github.com/microsoft/typespec/issues/3011

iscai-msft commented 1 week ago

Removing the tcgc label from this, because "spread is spread" largely gets away from this issue for tcgc generation.