dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
21 stars 16 forks source link

Add an "exclude" field to reference imports for configurations #852

Open drodarie opened 2 months ago

drodarie commented 2 months ago

As a user, I wish to be able to import a configuration content and specifying fields that I want to ignore / not import.

Helveg commented 2 months ago

there's a keys kind of thing for $import already, which can serve as a workaround. If you could source dive and clarify that mechanism here? :D should be:

$import:
  ref: ...
  keys: A, B, C

and then only the A, B and C key will be copied over.

You could rename that to include(_keys), exclude(_keys)

drodarie commented 2 months ago

I should have put more description: if I want to import every key from a file but one, then I have to specify all the other key. For instance, if I want to import every connectivity strategies from the connectivity field but the key A, I will have to list all the other keys from the connectivity field.

connectivity:
  $import:
    ref: path/to/file#/connectivity
    values:
      - B
      - C
      - D
      - ...

Now it does not matter if I want to override A: I can import it and have it modified by a local field:

connectivity:
  A:
    ...
$import:
  ref: path/to/file#/
  values:
      - connectivity

But if I do not want A anymore, I do not think there is an alternative. With the exclude field:

$import:
    ref: path/to/file#/
    values: 
      - connectivity
    exclude:
      - connectivity/A
Helveg commented 2 months ago

yea I think a general solution would be:

$import:
    ref: path/to/file#/
    include: 
      - connectivity
      - placement/B
    exclude:
      - connectivity/A

right? Where you have generic fine grained access to the nested keys you want to include and exclude?

Helveg commented 2 months ago

I think the behaviour should be: