Skip to content

Add support for describing headers#185

Merged
alien-mcl merged 5 commits intoHydraCG:masterfrom
alien-mcl:issue/99_Add_support_for_describing_headers
May 14, 2019
Merged

Add support for describing headers#185
alien-mcl merged 5 commits intoHydraCG:masterfrom
alien-mcl:issue/99_Add_support_for_describing_headers

Conversation

@alien-mcl
Copy link
Copy Markdown
Member

This is a derivative of a PR #182 that covers #99 :

  • added terms for providing returned/expected headers
  • added support for header value templating

@alien-mcl alien-mcl mentioned this pull request Feb 11, 2019
Copy link
Copy Markdown

@angelo-v angelo-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have a textual explanation and usage examples in addition to the JSON-LD changes.

Comment thread spec/latest/core/core.jsonld Outdated
"@id": "hydra:IriTemplate",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"subClassOf": ["hydra:Template", "hydra:Resource"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to mention hydra:Resource here? A hydra:Template is a hydra:Class is a hydra:Resource.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not typed hydra:Template as any of the hydra types, thus to maintain backward compatibility, we have to point to hydra:Resource directly.

Copy link
Copy Markdown
Contributor

@tpluscode tpluscode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have a textual explanation and usage examples in addition to the JSON-LD changes.

I concur. Even more, I'd say that we should first discuss the needs and requirements for these and other changes.

Like I said in #182, I think it should be a hard rule to first come up with an issue detailing what and why we need and only then attempt any changes to the specification.

"label": "Template",
"comment": "Some abstract template.",
"vs:term_status": "testing"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to challenge the very need for an abstract template. It sounds like smuggling OOP terminology into the vocabulary which strikes me as awkward

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm opened for alternatives.

This approach is to have backward compatibility and ability to use hydra:template on both hydra:IriTemplate and newly introduced hydra:HeaderTemplate.

Another approach would be to introduce completely new hydra:template alternative for hydra:HeaderTemplate. I think it would be prone to errors.

Yet another approach would be to completely remove header templates at all. I believe templates could cover more complex header value scenarios, i.e. those for PREFER, where you provide some complex expressions that could be bound to variables.

Comment thread spec/latest/core/core.jsonld Outdated
"@id": "hydra:IriTemplate",
"@type": "hydra:Class",
"subClassOf": "hydra:Resource",
"subClassOf": ["hydra:Template", "hydra:Resource"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion the weirder part is actually introducing inheritance here. IriTemplate is not just any string template. It is meant as implementing the rfc6570. The changes here make the relation with its original RFC... complicated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rfc6570 is just the default:

The literal's datatype indicates the template syntax; if not specified, hydra:Rfc6570Template is assumed.

And this quote only describes the hydra:template property, not the hydra:IriTemplate

Nevertheless I also have a bad feeling with this type of inheritance.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, RFC 6570 is not directly bound to IriTemplate. In RDF representation of hydra spec it is connected only via seeAlso, thus no strict data type is enforced.

Comment thread spec/latest/core/core.jsonld Outdated
"label": "mapping",
"comment": "A variable-to-property mapping of the IRI template.",
"domain": "hydra:IriTemplate",
"domain": "hydra:Template",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless of the other template changes, I think this should remain an IRI Template.

Or to test the logic, does it make sense to have a HeaderTemplate used with rdf:Property?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the hydra:HeaderTemplate would also need a hydra:mapping. I've just noticed that the range should be also decoupled from IriTemplateMapping.

The thing is, IriTemplate implies ... an IRI, which is not the case here. For headers (or body in future??) that would be completely different templating mechanism (i.e. razor :P)

Comment thread spec/latest/core/core.jsonld Outdated
"vs:term_status": "testing"
},
{
"@id": "hydra:HeaderTemplate",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still on the subject of headers, I think we're reinventing the wheel here.

What do you think about adopting the structure and terminology from actual HTTP spec to describe the headers?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been discussed already: #109

It seems that using unmaintained vocabulary that would in addition tightly couple hydra to a specific protocol is not a good idea. Hydra is meant to be protocol-agnostic, thus I don't see any option of using such vocabularies in the spec. -- #109 (comment)

Regarding this, should we support the description of (HTTP) Headers anyway?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I did not mean to propose the HTTP vocabulary. Just to follow the actual protocol specification to describe headers

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, misinterpreted that, should have followed the link ^^

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea with template in headers was to allow server to provide i.e. complete request template, including headers and/or body so the client just binds that template with variable values and sends back.

…is might ba an overkill. Added specification paragraphs related to headers.
…to issue/99_Add_support_for_describing_headers
Copy link
Copy Markdown
Contributor

@tpluscode tpluscode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alien-mcl as discussed on the call, please fix line endings in core.jsonld

@angelo-v
Copy link
Copy Markdown

angelo-v commented May 2, 2019

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants