feat: option to use c# 11 required keyword for required properties
This PR adds a UseRequiredKeyword option to the C# code generator. This will use the required modifier, added in C#11, for any properties that are required in the json schema.
@RicoSuter ping!
I'd love this feature!
I was just looking how to do that myself. I do have an additional require-ment (jk), namely I want nullable properties (both structs and NRTs) to not have that keyword. I see that there's already a similar setting GenerateOptionalPropertiesAsNullable - would it be possible to also have a SkipRequiredKeywordOnNullableProperties with preferably better name, or an opposite of it? Pretty pretty please...
@amis92 Isn't this already the case, given that a property is only treated as nullable if GenerateOptionalPropertiesAsNullable is enabled and the property is not required?
https://github.com/RicoSuter/NJsonSchema/blob/9bf8f695b373410e8b51e1363270c08dda7b8127/src/NJsonSchema.CodeGeneration.CSharp/Models/PropertyModel.cs#L54-L55
That, or the null is allowed by type JSON Schema keyword.
Lgtm, thanks for the PR.