RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.77k stars 1.29k forks source link

Custom methods names, summaries and decimal issue #4469

Open HayeLoic opened 1 year ago

HayeLoic commented 1 year ago

I have that C# code

[AttributeUsage(AttributeTargets.Method)]
public class ClientNamingAttribute : Attribute
{
    public ClientNamingAttribute(string value)
    {
        ArgumentNullException.ThrowIfNull(value);
        Value = value;
    }

    public string Value { get; }
}

And I use it in my controller like this: [ClientNaming("MyCustomMethodName")]

With this, Nswag generate methods with the expected custom name.

But I needed to have my summaries in the client, so I add in my csproj:

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>

And beacause of that, my ClientNamingAttribute is ignored. And also, my decimal parameter are now double. How could I fix this ?

HayeLoic commented 1 year ago

I also have this configuration for Swagger:

builder.Services.AddSwaggerGen(opts =>
{
    var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
    opts.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});