Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnsureMappings (plural) #311

Open
mih opened this issue Oct 8, 2022 · 1 comment
Open

EnsureMappings (plural) #311

mih opened this issue Oct 8, 2022 · 1 comment

Comments

@mih
Copy link
Member

mih commented Oct 8, 2022

Right now, each parameter has a constraint and validation etc requires countless loops over parameters to implement. Ultimately, however, all command parameters together can be viewed as a set of parameter names that map to their individual constraints. Such an EnsureMapping could provide a constraint for an entire command. Importantly, at this level a constraint could also implement rules for inter-parameter relationships (e.g. #289)

mih added a commit to mih/datalad-next that referenced this issue Dec 13, 2022
This provides a solution to the `EnsureMappings` proposal from
datalad/datalad-gooey#311, albeit in
a command-specific fashion.

This now establishes an interface to perform additional validation steps
(uniformly across all APIs) after per-parameter validation was completeded
successfully.

The underlying validator class could also be a source for documentation
to be exposed to users via the help-generation tooling, but this is not
done here, because they largely sit in datalad-core.

The utility of this approach is demo'ed on the `credentials` command,
which moves information from one parameter to another, depending
on the origin API. This is fully captured, and no validation or
type conversiion code remains in the actual command implementation
(`__call__`).

The impact on implementation complexity for commands that do not
require validation of inter-parameter dependencies is demo'ed
for the `download` command.

Ping datalad#115
mih added a commit to mih/datalad-next that referenced this issue Dec 13, 2022
This provides a solution to the `EnsureMappings` proposal from
datalad/datalad-gooey#311, albeit in
a command-specific fashion.

This now establishes an interface to perform additional validation steps
(uniformly across all APIs) after per-parameter validation was completeded
successfully.

The underlying validator class could also be a source for documentation
to be exposed to users via the help-generation tooling, but this is not
done here, because they largely sit in datalad-core.

The utility of this approach is demo'ed on the `credentials` command,
which moves information from one parameter to another, depending
on the origin API. This is fully captured, and no validation or
type conversiion code remains in the actual command implementation
(`__call__`).

The impact on implementation complexity for commands that do not
require validation of inter-parameter dependencies is demo'ed
for the `download` command.

Ping datalad#115
@adswa
Copy link
Member

adswa commented Apr 20, 2023

The respective TODO item in the linked datalad-next issue is ticked off since December 13th, implemented in mih/datalad-next@f61f8c9. However, I don't think it has been used in here or in #401

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants