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

[Feature request] Override DefaultRequired when creating schema for object with NRT enabled #346

Open
Drake53 opened this issue May 18, 2024 · 0 comments

Comments

@Drake53
Copy link

Drake53 commented May 18, 2024

When creating a schema with Required.Default or Required.AllowNull, properties in the schema have null as an allowed type. When nullable reference types are enabled, I expect properties which cannot be null to not allow null in the schema:

public class MyClass
{
  public string CannotBeNull { get; set; }
  public string? CanBeNull { get; set; }
}

In this case, I expect the schema type for CannotBeNull to be "string", and CanBeNull to be [ "string, "null" ].

Optionally, the same can be done for required properties when using Required.Default or Required.DisallowNull, where properties that cannot be null are automatically added to the required properties list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant