Components.js icon indicating copy to clipboard operation
Components.js copied to clipboard

Allow overriding variables that have been assigned a value in the configuration file

Open RubenVerborgh opened this issue 4 years ago • 6 comments

Variables have been added to Components.js in v3.6.0. We can set them programmatically: https://github.com/solid/community-server/blob/e1533a0869071bbeabf0edfdfd05ccf57883cdaa/src/init/CliRunner.ts#L42-L46

However, could I also give them a value inside the Components.js config? https://github.com/solid/community-server/commit/1dd140ab61845ae8df67c16883136736146549dd#diff-fec64cbd09e800f0351eb81eaaef521a1b9fecef9f81a3584d513e4f1266b6c0R4-R15 That might be handy to propagate string/number values around.

RubenVerborgh avatar Dec 01 '20 08:12 RubenVerborgh

Actually, something like this may already work (untested):

{
  "@id": "ex:myComponentInstance",
  "ex:param": { "@id": "ex:myVariable" }
}
{
  "@id": "ex:myVariable",
  "value": "123"
}

rubensworks avatar Dec 01 '20 13:12 rubensworks

They can act as a default that can be overwritten by configuration. (On that note… can we overwrite any component? 😛)

RubenVerborgh avatar Dec 07 '20 16:12 RubenVerborgh

On that note… can we overwrite any component?

You can only overwrite default values in parameters. If you actually instantiate a param's value, you can only append values, not overwrite them.

rubensworks avatar Dec 09 '20 10:12 rubensworks

value conformed working (for variables); I love it.

RubenVerborgh avatar Dec 20 '20 20:12 RubenVerborgh

Mmm, was too soon. Seems like variables with a configured value cannot be overridden.

RubenVerborgh avatar Dec 20 '20 21:12 RubenVerborgh

Actually, something like this may already work (untested):

{
  "@id": "ex:myComponentInstance",
  "ex:param": { "@id": "ex:myVariable" }
}
{
  "@id": "ex:myVariable",
  "value": "123"
}

Actually, only the first one works; the second one does not.

RubenVerborgh avatar Jan 01 '21 22:01 RubenVerborgh