Skip to content

Configure non-nullable types as required #2036

@coder925

Description

@coder925

In my project we do not distinguish between required and nullable: false. If a type is non-nullable, it is also required. This is regardless if it is a value type or reference type.

It would be great if one could optionally configure Swashbuckle to set all non-nullable properties to required. E.g. like: setupAction.MarkNonNullableTypesAsRequired(); This way, I could remove all my [Required] annotations on the non-nullable C# properties.

This is a subsequent request following #1686. As originally posted by @felschr in #1686 (comment) , treating non-nullable as required is the default for nullable contexts in .NET validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2Medium priority

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions