microsoft / typespec

https://typespec.io/
MIT License
4.5k stars 215 forks source link

[http-server-csharp] `tuple` types are not properly generated #5000

Open ArcturusZhang opened 1 week ago

ArcturusZhang commented 1 week ago

I copied one of our test projects in csharp client generator, it has an auth model:

model AuthFlow {
    type: OAuth2FlowType.clientCredentials;
    tokenUrl: "https://api.example.com/oauth2/token";
    refreshUrl: "https://api.example.com/oauth2/refresh";
    scopes: ["https://api.example.com/.default"];
}

This is generated incorrectly:

    ///<summary>
    /// The auth flow model
    ///</summary>
    public partial class AuthFlow
    {
        public Type { get; set; }

    public string TokenUrl { get; } = "https://api.example.com/oauth2/token";

    public string RefreshUrl { get; } = "https://api.example.com/oauth2/refresh";

    public {
        "https://api.example.com/.default"
      }
Scopes { get; set; }

    }

and this piece of code (the Scopes part) cannot compile.

markcowl commented 2 days ago

Needs to use the same treatment for item type properties as singular type properties