-
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
Another take on non-RDF payloads (aka file upload) #199
Comments
I think this looks like a great proposal. Flexible without being too complex. 👍 |
Just as a quick note - I think the approach taken in #186 is less revolutionary, but I can see both approaches has some similarities ( As for multiple files upload - bare in mind that there are several possibilities:
I'll provide more feedback later |
Indeed, but I think we need revolutionary
Definitely inspired by the former proposals, but I intend a flexible solutions
would the min/max cardinalities cover that? Having multiple 0-1 parts, each for a different class...
Short answer: 🤮 And cannot agree with the serious processing.
We could use those terms for property cardinalities. On the other hand the multipart support could be its own auxiliary spec, with its own specific terms. Much like SHACL will definitely be an independent extension and shapes have their own cardinality lingo. |
Haven't thought this trough yet, but looks good at first impression 👍 |
Not really - there are a couple of other specs built on top of hydra that has some more implementations. We shall keep as much of the backward compatibility as possible. I'd still like to downgrade the mentioned rdfs:range from
Well - those approaches also claimed to be flexible.
I meant we need to think it over carefully. There are several places that would benefit from cardinality specifications. There are also other vocabs that already provide these semantics.
Quite the opposite -
I remember I tried to send a multipart requests in a browser and it end up with not so nice code. Maybe something has changed since that time, but it is not something a browser can provide out of the box. Maybe there are already some JS libraries to make it easier, but it still requires some heavy stuff written that uses file API, buffers and other quite fresh JS elements available in modern browsers. In general - it feels like 'RequestSpecification'/'supportedContentType' related part is somehow similar to terms presented in #186 and both should meet same criticism and alternate ideas, i.e. @angelo-v 's approach with more generic constraint-like specifications (experiment provided with #187). As for the multipart content - it looks like it was created solely to meet some particular requirement and feels it was not well considered. It seems to be heavily coupled with HTTP and it does not tackle various scenarios (i.e. pre-uploading like in web mail clients where attachments can be uploaded before sending an email). |
I concur. The only issue I have with just the "downgrade" is that we'd completely lose any semantics. Replacing that with
Yes, I definitely wish to keep
Like I said, #187 is confusing in how it brings collections into the mix. And #186 is just a tad too narrow in scope. I opened this to offer a more open solution which can potentially include SHACL and possibly unexpected extensions. Let's find middle ground.
Maybe let's ignore multipart for now. If we can get the basic structure extensible "enough", then such an extension can be developed on the side without invading the core.
It is similar. I hoped to gather the best of both ideas. |
But it breaks existing clients and specs.
Well, baby steps. I feel this issue is to wide
Yep - sounds reasonable.
I'm opened. I'll invite community on the mailing list tomorrow (I've reached my limit today) to the discussion. |
Describe the requirement
We've approached the problem of non-RDF media types a few times already. Unfortunately it seems that each time it was not focused enough. Either mixed with collections (#187) or lacking broader context (#186).
Looking back at both, I think they are on track, but need a little more refinement.
For this issues, I'd like to focus on
expects
only and not returned representationsHydra-agnostic example
I would distinguish 3 kinds of requests coming to a Hydra API:
RDF payloads - such that are currently described by
expects
andClass
.Non RDF-payloads
Directly uploading an image instead of RDF:
multipart/form-data
Submitting multiple images and RDF data:
Hydra should allow describing operations which
expect
both kinds of file uploads.Proposed solutions
It is important to keep support for the current
expect
semantics.I propose that we extend the existing structure with a media-type description. Unfortunately it is not possible to have it both ways without revolutionising the structure, so the vocab will have to remove
rdfs:range
fromexpects
and useschema:rangeIncludes
instead.Example of
hydra:Class
usageThis would be equivalent to
"expects": "mov:Movie"
and both should be supported at least for a while.Example of non-RDF payload
supportedContentType
could also use a more elaborate structure though I'm not conviced it's necessary.Example of multipart
Above interpreted as:
mov:Movie
allowedParts
has same domain ascontent
, extended with multipart-specific bit such as the min/max countMultipartContent
would have to become part of the core vocabulary.Implications
The consequences of such design are far reaching:
By introducing
RequestSpecification
we can directly describe HTTP requests (such as by usingexpectHeader
)The
content
predicat can be an extension point we've talked about, allowing 3rd party vocab to describe bodies using SHACL. Something like
ShaclContentSpecification subclassOf ContentSpecification
It will even be possible to define operations which expect markdown, plain text or any other textual format
Alternative solutions
Here's how Open API does that for file uploads and multipart requests. For example
Note that
id
,address
andprofileImage
will be separate request parts.The text was updated successfully, but these errors were encountered: