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

Make alternative short predicates available for options hashes with @nest #62

Open
RubenVerborgh opened this issue May 19, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@RubenVerborgh
Copy link

In addition to

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld",
  "@graph": [
    {
      "@id": "urn:solid-server:default:IndexConverter",
      "@type": "ConstantConverter",
      "contentType": "text/html",
      "filePath": "./node_modules/mashlib/dist/databrowser.html",
      "options_container": true,
      "options_minQuality": 1
    }
  ]
}

could we also allow

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld",
  "@graph": [
    {
      "@id": "urn:solid-server:default:IndexConverter",
      "@type": "ConstantConverter",
      "contentType": "text/html",
      "filePath": "./node_modules/mashlib/dist/databrowser.html",
      "container": true,
      "minQuality": 1
    }
  ]
}
@RubenVerborgh RubenVerborgh added the enhancement New feature or request label May 19, 2021
@rubensworks
Copy link
Member

That might be possible, but then we'll have to take into the account of the possibility of conflicting variable names.

Also, a (perhaps bigger) question is how to enable this functionality, as we may not want to enable this by default due to the possibility on conflicting variable names.
A first option could be to add some kind of annotation in the jsdoc of a variable name, which indicates that its Components.js name should be "shortened".
A second option could be to configure this across the whole package, as a flag to the generator's CLI tool.
Perhaps having both may even make sense.

Another thing I'm also not sure about is the "also allow" part of this functionality, perhaps there may be a need to "instead allow". But this could also be solved via a CLI flag.

@RubenVerborgh
Copy link
Author

That might be possible, but then we'll have to take into the account of the possibility of conflicting variable names.

Precedence is fine here for me. (Perhaps the generator doesn't even need to know, and the JSON-LD context just overrides it.)

as we may not want to enable this by default due to the possibility on conflicting variable names.

Default seems fine if there is precedence.

"also allow" part of this functionality

It's just an alias?

@rubensworks
Copy link
Member

Alternatively, we could also enable something like this:

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^0.0.0/components/context.jsonld",
  "@graph": [
    {
      "@id": "urn:solid-server:default:IndexConverter",
      "@type": "ConstantConverter",
      "contentType": "text/html",
      "filePath": "./node_modules/mashlib/dist/databrowser.html",
      "options": {
        "container": true,
        "minQuality": 1
      }
    }
  ]
}

This may be a better reflection of the actual constructor interface, and avoid conflicts completely.
This could be done internally using JSON-LD's @nest functionality.

In any case, the alias-based approach is definitely also possible.

@RubenVerborgh
Copy link
Author

I love the above.

@rubensworks rubensworks changed the title Make alternative short predicates available for options hashes Make alternative short predicates available for options hashes with @nest May 26, 2021
@rubensworks
Copy link
Member

The alias solution will be supported in 3.x. Will leave this issue open for the @nest.

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

No branches or pull requests

2 participants