Expand command lifecycle with optional arg validation, results#162
Expand command lifecycle with optional arg validation, results#162bollwyvl wants to merge 15 commits intojtpio:mainfrom
Conversation
|
|
|
@jtpio this is still fairly WIP (no particular tests) but seems to drive pretty well in lab/notebook and lite. |
|
A down side of adding validation is that no To fully remove it from being (re-)bundled, it would be theoretically possible to grab an existing one off of:
|
|
Welp, i had a quick look at the panels notebook: looks like there's a fair amount of drift that would need some investigation, and is probably outside the (already sprawling) scope of this PR. |
|
@jtpio finally circled around with the |
references
changes
CommandRegistrydescribe(id, args, handler)iconlabelcaptionicon_classdescribed_byadd_command(...described_by={"args":{}}executevalidate=Trueajvclient-side to validate argshandler=Callable[[Any, List[Any], ...]jupyterlite-(core|pyodide-kernel) 0.7.0rcpackage.jsonconsistent-type-importslintersharedPackagesconfiguser-facing changes
backwards-incompatible changes
notes
on
main, command execution is "fire-and-forget"...graph TB subgraph py subgraph CommandRegistry py-ex[".execute(id, args)"] end end subgraph js subgraph CommandRegistryModel js-ex[._execute] end subgraph AppCommandRegistry [CommandRegistry] real-ex[.execute] end end py-ex --> js-ex --> real-ex...on this PR, with optional
validateandhandler, results (or errors) come backgraph TB subgraph py subgraph CommandRegistry handler["handler(result, error)"] py-ex[".execute(..., <br/>handler, validate=True)"] end end subgraph js subgraph CommandRegistryModel js-val["._validate"] js-ex[._execute] end subgraph AppCommandRegistry [CommandRegistry] real-ex[.execute] describe[.describe] end ajv end handler --> py-ex --> js-val js-val -- await --> describe --> js-val js-val -- validate(args) --> ajv --> js-val -.-> js-ex js-ex -- await --> real-ex real-ex --> js-ex -- "result<br/>errors" --> handler js-val -- errors --> handler