1

Closed

Add an attribute to JsonObject, RequiredByDefault

description

It is currently possible to mark a property as required, by using the [JsonProperty(Required = Required.Always)] notation.
 
It would, however, be really nice if it was also possible to mark on class-level that all properties are to be Required by default. (In essence, change the Required.Default setting - making it still possible to "opt out" certain properties that are not required if you like.)
 
This can be pretty convenient sometimes, when you have full control over both ends (both the sending and the receiving), and want to catch simple typos, uncoordinated changes in one end, etc. Could it be done?
 
My suggestion would be to add a RequiredByDefault property to JsonObject, which does this. If you find a better name, feel free to modify it as you like. Many thanks in advance, and thanks for a great library.
Closed May 4, 2012 at 12:11 PM by JamesNK
Done. Will be called ItemRequired (naming standard fits with other new item level attributes)

comments