Description
openedon Jul 23, 2024
It seems like public constructors for the "Anonymous"
authentication scheme are never created. When running autorest against test_api.json as follows:
autorest --input-file=.\test_api.json --csharp --output-folder=./generated --generation1-convenience-client --skip-csproj --clear-output-folder --namespace="Test.Client.Generated" --public-clients --security='["Anonymous", "AADToken", "AzureKey"]'
I specified all 3 types of supported authentication, but only 2 public client constructors are generated - one for AzureKeyCredential
and one for TokenCredential
.
The solution would be to also generate constructors without a credential parameter for anonymous access, if either this is specific in the OpenAPI 3.0 JSON spec via "security": [ {} ]
(at the request or global level) or via the autorest command line via --security='["Anonymous"]'
The only workaround I currently see is to extend the partial client class autorest generates and add a credential-less constructor myself, but this isn't super ideal.