Skip to content

[Bug]: When using NonNullableReferenceTypesAsRequired, both required and nullable exist #3297

@LiuYuLu

Description

@LiuYuLu

Describe the bug

Image

Expected behavior

Remove the summary field "nullable": true configuration

Actual behavior

No response

Steps to reproduce

No response

Exception(s) (if any)

Use the net9 default webapi template
Add or modify the following configuration

builder.Services.AddSwaggerGen(c => c.NonNullableReferenceTypesAsRequired());

app.UseSwagger();
app.UseSwaggerUI();

Remove the ? in front of the Summary attribute.

public class WeatherForecast
{
    public string Summary { get; set; }
}

Swashbuckle.AspNetCore version

7.3.1

.NET Version

net9

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp-wantedA change up for grabs for contributions from the community

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions