-
Notifications
You must be signed in to change notification settings - Fork 152
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
Compact API first expands without provided context #156
Comments
We could also just change the parameters to include an |
PROPOSAL: Change the compaction API signature from This would imply that the |
Lately I have also been thinking about combining the
This might even eliminate the need for the flattening flag. We could instead use a
An empty frame or null would invoke expansion; a frame consisting of just a context would invoke compaction, and the only other mechanism currently supported would be to filter for nodes by including the This would also keep us the door open to enhance framing quite easily in the future. |
I'm -1 on this. It seems like we're just making the API more cumbersome. Most, if not all, of the API methods already first expand the input before acting on it. Requiring an additional context -- just to handle the single case where one was only provided via a link header -- causes the API to be more complex for every other case (where I believe the other cases are more common). If you need to expand your input in some other way (eg: because the context came in via a link header), then do that before making the other API calls you want to make. I don't think that's unreasonable -- and I think it keeps the API simple. |
RESOLVED: Move the optional expansion context parameter in the .expand() call into the last JsonLdOptions parameter. |
RESOLVED: Process the 'expandContext' option when performing .compact(). When expanding during the .compact() call, the 'expandContext' is applied first, followed with any other contexts held in the document being processed. |
The Compact API first expands the input document, which is fine. However, even though it's not called out in the spec, the test require (AFIKR) that the document be expanded without using the provided context. The context is only used for compacting the document.
The problem comes when non-JSON-LD documents are passed through the algorithm where the context was provided via a Link header. This would require first a call to expand with the provided context, and then a call to compact with a newly provided context, which would also attempt to expand the incoming document.
Two ways to potentially deal with this:
The text was updated successfully, but these errors were encountered: