microsoft / microsoft/typespec
[Azure:Python] Add audience kwarg to constructor
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Clear and concise description of the problem
Today, we generate client constructor that takes `credential_scopes` as an array, for instance:
```
self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
```
_For Azure only_, we want to add `audience`, that works this way:
- It's a string parameter
- It's optional, and default to the scope of the TypeSpec, but without `/.default`. For instance, `https://cognitiveservices.azure.com`
- If credential_scopes xor audience are used, they are winning over the TypeSpec definition.
- If both credential_scopes and audience are present as user input at the same time, log a warning and use `credential_scopes` (ignore `audience`
- Document `audience as a docstring, and make it a kwarg only syntax
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [docs](https://typespec.io/docs/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
Assessment
This issue has not been assessed yet.