Closed alexander-haller closed 4 months ago
In GitLab by @mhxion on Jun 24, 2024, 02:15
requested review from @alexander-haller
In GitLab by @mhxion on Jun 24, 2024, 02:25
PR fixes #47.
In GitLab by @project_994_bot_1c5bd6ac1fdbd740fbc4ed080ecff58d on Jun 24, 2024, 02:43
added 1 commit
In GitLab by @project_994_bot_1c5bd6ac1fdbd740fbc4ed080ecff58d on Jun 24, 2024, 02:56
added 1 commit
approved this merge request
In GitLab by @mhxion on Jun 24, 2024, 13:10
approved this merge request
In GitLab by @mhxion on Jun 24, 2024, 13:10
I actually meant to merge and not approve it myself lol. Thanks for approving!
In GitLab by @mhxion on Jun 24, 2024, 02:15
Merges overridable-config -> dev
This PR mainly adds necessary design improvements to configuration system to make room for proper 3rd-party plugin support. We introduce a lot of new architectural improvements and a few new features.
--override-config
/--OC
What we have seen in the meeting so far. One visual change made just now was:
--OC
was moved to its own section calledelapi global options
. This is to mean--OC
is not quite like the other global option--help
, where--OC
can only be passed after the main program nameelapi
, and--help
can be passed after almost any command/sub-command. This will also allow us to add more global options like--OC
in the future.Ease of plugin creation
Creating a plugin would now require just two lines of code inside
cli.py
.Robust configuration
Configuration values in
elapi.yml
are now properly validated. This fixes #30.This configuration validation is automatically run for all plugins (internal and 3rd-party). Scripts that are not plugins, however, will need to add the following boilerplate code for the validation to run. Though, running validation is not strictly necessary.
New configuration fields
We introduce two new configuration fields that will affect all plugins and raw commands.
elAPI's design pattern (or architecture) for plugin support
elAPI is built on a distinct design pattern named "Simple layered design pattern" that has allowed plugin support relatively swiftly with minimal maintenance in the first place. This design pattern is a generalization of layered pattern that doesn't have most of the cons of layered pattern. Until now, the implementation of the architecture was flawed. With this PR, the implementation is much more stable. Documentation/literature about this design pattern is yet to be completed.
elAPI-design-pattern.pdf
Additional remarks
elAPi is only accepting JSON as its input format for most CLI inline options including the new
--OC
, and--data
,--header
,--query
. Typing JSON can get cumbersome and can be error prone. It'd be nice to be able to pass a YAML/JSON file instead. This was Alexander's suggestion which is yet to be worked on.