-
Notifications
You must be signed in to change notification settings - Fork 16
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
Consider lazy response processing #2
Comments
As discussed in HydraCG/Specifications#138, a |
Well, fetch is already promise-based so it's a natural pattern to follow with any deferred processing. I'd even use async/await... And about processing itself, yes the client cannot assume what would be returned from an endpoint. That information must be determined only after receiving the bits. |
With How do we reap the benefits of the event/callback approach being decoupled without using an event/callback approach, but
Exactly. I therefore find that |
If we look at the current snippet with getCollection() var operation = client.get("http://example.com")
.getApiDocumentation()
.getEntryPoint()
.getCollection({
property: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
object: "http://schema.org/Event"
})
.getOperationOfType('http://schema.org/CreateAction'); we can see that it does not take an IRI as parameter but {
"@context": "/api/context.jsonld",
"@id": "/api",
"@type": "hydra:EntryPoint",
"collection": {
"@id": "/api/events",
"title": "List of events",
"@type": "hydra:Collection",
"manages": [
{
"property": "rdf:type",
"object": "schema:Event"
}
],
"operation": [
{
"@type": ["hydra:Operation", "schema:CreateAction"],
"title": "Create new event",
"method": "POST",
"expects": "schema:Event"
}
]
}
} Maybe name function selectCollection (pattern) {
return this.collection.find(col => col.manages.includes(pattern))
} |
|
I would see it appropriate for the client to besides generic function selectCollectionByMembersType (membersType) {
return this.selectCollection({
property: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
object: membersType
}))
} To get back on my point about |
I filed a separate issue for the collection selection discussion. Let's keep this issue focus on the lazy processing aspect. Please also keep in mind that lazy processing is not about asynchronous network requests. If we need discussions for that too, please file a separate one. |
There is an option of having a lazy payload processing implementation that would carry a response object received from the 'fetch' API and use the client's facilities to process that response on demand once proper properties or methods are invoked.
This may delay or in some cases prevent unnecessary processing.
The text was updated successfully, but these errors were encountered: