Skip to content

Schema Metadata for C# 9 RecordsΒ #1920

@RehanSaeed

Description

@RehanSaeed

C# 9 Positional Records & XML Comments

We can't use positional records with XML comments because there is no way to provide comments for the properties. There is a Roslyn bug open for this at dotnet/roslyn#44571. This would be the ideal solution.

C# 9 Records & XML Comments

We can create init properties instead and comment them as usual. This works.

/// <summary>A product.</summary>
public record Product
{
    /// <summary>Gets or sets the unique identifier.</summary>
    public int Id { get; init; }
}

C# 9 Positional Records & Swagger Annotations

Using the [SwaggerSchema] attribute in a positional record doesn't seem to work. Please can support for this be added?

public record Product([SwaggerSchema("The product identifier")] int Id);

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2Medium priority

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions