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

Allow users to pass Comunica context through the library #22

Open
alexkreidler opened this issue Nov 14, 2020 · 1 comment
Open

Allow users to pass Comunica context through the library #22

alexkreidler opened this issue Nov 14, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@alexkreidler
Copy link

The RdfDereferencerBase passes options of type IDereferenceOptions to the cbrd:Bus/RdfDereference via the mediate function as the context.

See here:

return this.mediatorRdfDereference.mediate({
context: ActionContext(options),
headers: options.headers,
method: options.method,
url,
});

Since the context exposes a variety of options for users to configure Comunica, such as an HTTP proxy for example, which is quite relevant to rdf-dereference, it makes sense for users to be able to provide the context to rdf-dereference.

That could be achieved by

  • Making IDereferenceOptions a broader type (e.g. extending it to include Record<string, any>) It would have to be that wide because not all context options are simple strings, some are functions or objects
  • Adding a separate context field to the IDereferenceOptions and passing that as the context to mediate

Of course, users could simply override Typescript to pass the context as they want currently as additional fields on the option argument, but this would make it explicit and indicate to users that it is a valid option.

@rubensworks rubensworks added the enhancement New feature or request label Nov 16, 2020
@rubensworks
Copy link
Owner

Good point! Option 1 seems like the most straightforward to me. (could also be applied to https://github.com/rubensworks/rdf-parse.js)

Feel free to submit a PR on this!

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