Skip to content

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

Open

Description

@RubenVerborgh

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
    }
  ]
}

Activity

  1. added
    enhancement
    on May 19, 2021
  2. rubensworks commented on May 20, 2021

    @rubensworks
    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.

  3. RubenVerborgh commented on May 25, 2021

    @RubenVerborgh
    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?

  4. rubensworks commented on May 26, 2021

    @rubensworks
    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.

  5. RubenVerborgh commented on May 26, 2021

    @RubenVerborgh
    Author

    I love the above.

  6. changed the title [-]Make alternative short predicates available for options hashes[/-] [+]Make alternative short predicates available for options hashes with `@nest`[/+] on May 26, 2021
  7. rubensworks commented on Feb 8, 2022

    @rubensworks
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions