Closed
Bug 793765
Opened 12 years ago
Closed 7 years ago
ValidateOptions request: 3rd "strategy" argument for handling unknown keys
Categories
(Add-on SDK Graveyard :: General, defect, P3)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: glind, Unassigned)
Details
Use case: * validate the keys I care about * ignore other keys (which become essentially **kwargs) Options for 'strategy' might be: * strict | fail -> current * allow | ignore -> unknown / unvalidated keys are fine, and pass through * (a function) -> run on all unknown keys? (previous discussion around enhancements: https://bugzilla.mozilla.org/show_bug.cgi?id=569122)
Gregg, did you still need this?
Flags: needinfo?(glind)
Reporter | ||
Comment 2•12 years ago
|
||
Debatable. I built around this... Having ValidateOptions around is nearly as powerful JSONSchema. My own solution here is gross. I would rather see some power expansion in the core (options: omit, allow, 'function'). ====== let validateOptionsLiberal = exports.validateOptionsLiberal = function(options,requirements){ let out = validateOptions(options,requirements); for (let k in options) { if (! (k in requirements)){ out[k] = options[k] // unvalidated } } return out } =========
Flags: needinfo?(glind)
Priority: -- → P3
Comment 3•7 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•