-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Feature/action context #183
Conversation
Pull Request Test Coverage Report for Build 326
💛 - Coveralls |
I prefer 2 or 4. But 2 prevents defining contexts in config files, so I would keep it at 4. The majority of the actors doesn't make use of the context anyway, and if someone creates an actor that makes a lot of use of the context they can define their own variables to make for easier development. |
Ok, just added backwards compatibility. Ready for review now. |
2b97c7f
to
5aa0c69
Compare
* @return {Promise<T>} A promise that resolves to the handle test result. | ||
*/ | ||
public abstract async testHandle(action: HI, mediaType: string): Promise<HT>; | ||
public abstract async testHandle(action: HI, mediaType: string, context?: ActionContext): Promise<HT>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the context parameter be optional? This might encourage developers to not pass on the context when they receive it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes sense. The context can still be null, but all remove the ?
everywhere to make it clear that the context must be passed along.
This is an abstraction of the query operation context, and allows data to be passed to any actor. Closes #109
5aa0c69
to
52be168
Compare
Implements the generalization of a shared context #109.
Do not merge or review yet.Context keys are now namespaced, for example:
{ '@comunica/bus-rdf-resolve-quad-pattern:sources': [{ type: 'hypermedia', value: ... }] }
The problem with this is that it becomes less convenient for programmatic API users to define sources.
A few possible solutions:
newSourcesContext([...])
. Downside is that it becomes more complicated when your context consists of several other stuff as well.@joachimvh What is your opinion on these solutions?.