discussion: TCGC validation that clientLocation moving parameter from method to client should only apply to parameter on operation
design:neededlib:azure-coretriaged:core
### Clear and concise description of the problem
We had a case that user doing this
[playground](https://azure.github.io/typespec-azure/playground/?e=%40azure-tools%2Ftypespec-client-generator-core&options=%7B%7D&vs=%7B%7D&c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CskZYXp1cmUtdG9vbHMvyCUtY2xpZW50LWdlbmVyYXRvci1jb3JlIjsKCnVzaW5nIEh0dHA7xwxBxEAuQ8UxR8gwLkNvcmU7CgpAc2VydmljZQpuYW1lc3BhY2UgRGVmYXVsdMYxxFJuaW9uIEZlYXR1cmVPcHRJbktleXMgewogIGluc2lnaHRzX3YxX3ByZXZpZXc6ICJJxxY9VjFQxhUiLAogIHNjaGVkdWxlzy5TyBfNL30KCmFsaWFzIFdpdGjHF0hlYWRlcjzlAIMgZXh0ZW5kc%2FEAmD4gPeUAm0BoxS4oIsc9LccpcyIpCiAgx39fZscVPzogxUI7Cn07Cgptb2RlbCBSZXNwb25zZSB7fQoKQHJvdXRlKCIvcXVlcnkiKQppbnRlcmbkATBRxBJQYXJhbcZ5yCp7YWNjb3VudElkfcV0QGdldAogIGdldCgKICAgIEBwYXRoIMklOiBzdHJpbmfkASsgIC4uLvIA%2BvAA7C7zAYA%2BxEApOukAvjvkAUsvLyDmAjFMb2NhdOQBz3RhcmdldHMgdGhlIHRlbXBsYXRlZCDmATQgcHJvcGVydHkgaW7FIeUBigpAQM5EKO0CKfIAry7wAWUs7gJbKTsK)
The key problem here is this
- the `clientLocation` applies to the uninstantiated templated property in the alias
- the operations instantiate that alias with a specific union value as the parameter's type
---
We would not have this problem, if we required "**clientLocation moving parameter from method to client** should only apply to **parameter on operation**".
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/azure/typespec-azure/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that this issue is about the Azure libraries for typespec. For feature request in the typespec language or core libraries file it in the [TypeSpec repo](https://github.com/Microsoft/TypeSpec/issues/new/choose)
- [x] Read the [docs](https://azure.github.io/typespec-azure/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
2 条评论