Skip to content

[BUG] Public constructor for anonymous client auth missing #4934

Open

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    DPGDPG/RLC v2.1Post Gallium workv3Version 3 of AutoRest C# generator.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions