-
Notifications
You must be signed in to change notification settings - Fork 26
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
Vocabulary extensions #182
Conversation
- enable operations for non-RDF resources - enable operations for headers - enable operations with explicit operation target (API documentation) - enable strongly typed collections (API documentation) - enable client-side initiated pagination
spec/latest/core/core.jsonld
Outdated
"vs:term_status": "testing" | ||
}, | ||
{ | ||
"@id": "hydra:name", |
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.
hydra:name sounds very generic, as if you could name anything. Only the comment states, it is used to name a header. I would prefer hydra:headerName
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.
Good point. Here you go!
I've just pushed PR to Heracles.ts with support for these features. |
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.
I strongly disapprove of this pull request!
Please check my comments to individual pieces but there are bigger problems:
- looks like there are several unrelated changes
- none of the proposed changes have a related (or mentioned) PR and have not gone through some analysis beforehand
- it literally came out of the blue
Instead of haphazardly submitting PRs we must follow a more structured workflow and follow some ground rules as closely as possible (I accept that there will be exceptions):
- each PR should address a specific issue or at least related issues
- each issue should be first discussed, deemed important and have a rough idea of the solution
- PR with new features should not only introduce vocabulary elements but also extend upon the human-readable part of the spec.
I could go one step further and suggest that the prose should even come slightly before vocabulary. That way it could be easier to understand the intent and gauge the effect of said changes. On the other hand a discussion under the related issue would serve that purpose too.
@@ -59,6 +59,19 @@ | |||
"mapping": "hydra:mapping", | |||
"IriTemplateMapping": "hydra:IriTemplateMapping", | |||
"variable": "hydra:variable", | |||
"skip": { "@id": "hydra:skip", "@type": "xsd:integer" }, | |||
"take": { "@id": "hydra:take", "@type": "xsd:integer" }, |
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.
I think that skip/take are too specific go beyond Hydra Core. Sound more like Data than generic API description language.
I agree it's a desired feature but maybe this could became part of an extension focused on handling collections in different way?
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.
If it is a desired feature, it should be provided in the core. I'm opened for alternative approaches though. These are just terms that are commonly used in other querying languages like SQL (TOP, LIMIT), LINQ (Skip, Take), etc.
"@id": "hydra:target", | ||
"@type": "rdf:Property", | ||
"label": "invocation target", | ||
"comment": "Explicit target of the invocation of the operation.", |
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.
Related to #154?
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.
Yep, as it is stated in the PR's description at the very beginning
"domain": "hydra:Operation", | ||
"range": "xsd:string", | ||
"vs:term_status": "testing" | ||
}, |
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.
How about possibleResponseHeader
? That ways it's aligned with possibleStatus
and HTTP terminology
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.
I actually tried to be consistent with returns
/expects
. Indeed, for returned header possible
may work. For expected it won't
"domain": "hydra:Operation", | ||
"rangeIncludes": ["hydra:Header", "hydra:HeaderTemplate"], | ||
"vs:term_status": "testing" | ||
}, |
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.
Ditto, I propose to rename to requestHeader
for example
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.
While I believe both returned and expected headers should be connected to each other conceptually, this name is OK for me. For returned
it should be then responseHeader
"label": "Template", | ||
"comment": "Some abstract template.", | ||
"vs:term_status": "testing" | ||
}, |
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.
This is way too vague. Why do you think we need an "abstract template"? Sound very much like OOP
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.
I was for backward compatibility - I didn't want to introduce another term for template in headers, thus I had to revamp the domain of the existing one. I also didn't want to replace domain
with other predicate, thus this is why the abstract
"label": "Header template", | ||
"comment": "Specification of the header template with variables to be replaced with actual values.", | ||
"vs:term_status": "testing" | ||
}, |
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.
What is the practical need for this Header template?
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.
I was just wondering i.e. about an Authorization
header where you mark the authorization scheme and the secret following it. Maybe other vendor-specific headers would require this.
In general, this is indeed a feature covering exotic scenarios.
"@id": "hydra:Header", | ||
"@type": "rdfs:DataType", | ||
"label": "Header", | ||
"comment": "Specification of the header, including name and value(s).", |
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.
I wonder, what is the current stand on Hydra vs HTTP?
I mean, adding headers to the core signifies a close relation with the protocol. Did we ever decide to keep Hydra somewhat agnostic in that regard?
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.
There are possibleStatus
and method
- these are already quite strictly bound to the protocol. Also headers are not HTTP specific - other protocols may have similar notion. SOAP is a bad example here (as it can be over HTTP), but the envelope has a notion of the header as well.
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.
Point taken
"label": "Collection specification", | ||
"comment": "Describes a collection returned by the operation.", | ||
"vs:term_status": "testing" | ||
}, |
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.
Where does that come from? How would this come up against the "manages block"? Sounds similar
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.
Ther was an issue on denoting on the API what the collection describes. This was an attempt of enabling that part of the spec with such a description.
"label": "Media type", | ||
"comment": "An RFC 6838 compliant media type specification.", | ||
"vs:term_status": "testing" | ||
}, |
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.
The media type stuff is cool in principle but how does it relate to the other changes within this PR?
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.
I wanted to enable hydra to expect/return resources other than RDF. One of the approach of describing a resource would be to use the media type, i.e. for JPG or DOCX file that would be expected by the API
Ok. Indeed this is an imperfect attempt.
Indeed - there are several topics onboard
I partially disagree - operations with explicit targets were discussed quite extensively; other thing it didn't end up with any specific conclusion
I disagree - most of topics touched here were either discussed or at least mentioned; I also did advertised this attempt in various occasions
What kind of structured workflow? I agree that we didn't provide any detailed roadmap for future work, but GH is full of unresolved issues that needs to be addressed and should be treated as that roadmap. I remember how we did work in last several years and look were we are now.
I can cherry-pick each implemented feature as a separate PR if that will work for you.
As I already said - some of the features were discussed - some of them indeed may need some discussion. This is why that PR came anyway - to start discussion on some real approaches. I don't want to raise new issues to address other issues - it's pointless.
I may agree with this, but this would imply enormous effort on me still having a large risk of a complete failure. Once I confirm that these changes are going in the right direction, I may consider spec changes.
Also a discussion on some real implementation still serves that purpose. Cherry-picking each feature with some brief would improve how these changes should be understood. |
Without going into detailed discussions here I think this PR should be split into 3 PRs, which address the three linked issues it aims to resolve. The other two bullets should (non-RDF payloads and headers) should be first discussed as issues. Splitting into smaller chunks will allow for focused discussions and prevent one change block an unrelated one from being merged. On a technical note, it's best to avoid submitting PR from downstream |
Yep - I've just noticed master branch. One more reason to split it. As for new features - I'll try to dig through GH to find related issues. I'm pretty sure headers were mentioned somewhere. |
Extended vocabulary with these features:
In general, these imperfect attempt to extend the Hydra Core Vocabulary (HCV) should enable the it for some of the uses cases that appeared on various occasions. Feel free to deliberate more, but I hope these will find their way to the final specification.
I tried to keep backward compatibility so current implementations using the vocabulary in it's current state won't get broken. Unfortunately, there are some minor changes to some of the elements.
I've also added an updated version of the vocabulary.png diagram (including source code).
I'll try to provide a proper PR for Heracles.ts reference client covering these features ASAP.