Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Reference types not nullable with required modifier #2936

Closed
dsherret opened this issue Jun 6, 2024 · 1 comment
Closed

[Bug]: Reference types not nullable with required modifier #2936

dsherret opened this issue Jun 6, 2024 · 1 comment
Labels

Comments

@dsherret
Copy link

dsherret commented Jun 6, 2024

Describe the bug

Same steps as here: #2877 (comment)

Previously I could tell if reference types were nullable by looking at the required array, but now that's not possible.

Expected behavior

The otherRequiredNullable property should be nullable or there should be a way to disable the required modifier influcing the output. The purpose of the required modifier is to ensure that a property appears in an object initializer and projects piggybacking on it to create other meaning is very questionable (including annoyingly System.Text.Json).

Actual behavior

The otherRequiredNullable is still required:

image

Steps to reproduce

See #2877 (comment)

Exception(s) (if any)

No response

Swashbuckle.AspNetCore version

6.6.2

.NET Version

8.0.301

Anything else?

No response

@dsherret dsherret added the bug label Jun 6, 2024
@dsherret
Copy link
Author

dsherret commented Jun 6, 2024

I had the wrong configuration. It needed:

c.UseAllOfToExtendReferenceSchemas();

...in addition to...

c.SupportNonNullableReferenceTypes();

(Kind of confusing)

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant