-
-
Notifications
You must be signed in to change notification settings - Fork 361
Open
Labels
proposalInitial discussion of a new idea. A project will be created once a proposal document is created.Initial discussion of a new idea. A project will be created once a proposal document is created.
Description
I don't write objects with optional properties most of the time. I tend to prefer to use polymorphism to allow one of several data structures. When I do have an optional field, it's often something like "comments" or "extra info", and even then I don't have any philosophical objection to simply making it required but allowing it to contain the empty string.
An optional keyword to complement required would greatly benefit me (and hopefully others), without treading on the toes of people who are writing schemata with many optional values.
My proposition is thus:
- Either
requiredoroptionalmay be provided - It is an error to provide both
- The default remains as it is (everything optional), which is the same as providing
requiredwith an empty array - If
optionalis provided, anything not mentioned is now required - Passing an empty array to
optionalmeans everything is required
Hope that's both clear and a useful idea.
Metadata
Metadata
Assignees
Labels
proposalInitial discussion of a new idea. A project will be created once a proposal document is created.Initial discussion of a new idea. A project will be created once a proposal document is created.